commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AssetSourceBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class AssetSourceBuilder implements Builder
22 {
27  private $uri;
28 
33  private $key;
34 
39  private $dimensions;
40 
45  private $contentType;
46 
51  public function getUri()
52  {
53  return $this->uri;
54  }
55 
60  public function getKey()
61  {
62  return $this->key;
63  }
64 
71  public function getDimensions()
72  {
73  return $this->dimensions instanceof AssetDimensionsBuilder ? $this->dimensions->build() : $this->dimensions;
74  }
75 
80  public function getContentType()
81  {
82  return $this->contentType;
83  }
84 
89  public function withUri(?string $uri)
90  {
91  $this->uri = $uri;
92 
93  return $this;
94  }
95 
100  public function withKey(?string $key)
101  {
102  $this->key = $key;
103 
104  return $this;
105  }
106 
111  public function withDimensions(?AssetDimensions $dimensions)
112  {
113  $this->dimensions = $dimensions;
114 
115  return $this;
116  }
117 
122  public function withContentType(?string $contentType)
123  {
124  $this->contentType = $contentType;
125 
126  return $this;
127  }
128 
133  public function withDimensionsBuilder(?AssetDimensionsBuilder $dimensions)
134  {
135  $this->dimensions = $dimensions;
136 
137  return $this;
138  }
139 
140  public function build(): AssetSource
141  {
142  return new AssetSourceModel(
143  $this->uri,
144  $this->key,
145  $this->dimensions instanceof AssetDimensionsBuilder ? $this->dimensions->build() : $this->dimensions,
146  $this->contentType
147  );
148  }
149 
150  public static function of(): AssetSourceBuilder
151  {
152  return new self();
153  }
154 }
withDimensionsBuilder(?AssetDimensionsBuilder $dimensions)