commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ImageBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ImageBuilder implements Builder
22 {
27  private $url;
28 
33  private $dimensions;
34 
39  private $label;
40 
47  public function getUrl()
48  {
49  return $this->url;
50  }
51 
58  public function getDimensions()
59  {
60  return $this->dimensions instanceof AssetDimensionsBuilder ? $this->dimensions->build() : $this->dimensions;
61  }
62 
69  public function getLabel()
70  {
71  return $this->label;
72  }
73 
78  public function withUrl(?string $url)
79  {
80  $this->url = $url;
81 
82  return $this;
83  }
84 
89  public function withDimensions(?AssetDimensions $dimensions)
90  {
91  $this->dimensions = $dimensions;
92 
93  return $this;
94  }
95 
100  public function withLabel(?string $label)
101  {
102  $this->label = $label;
103 
104  return $this;
105  }
106 
111  public function withDimensionsBuilder(?AssetDimensionsBuilder $dimensions)
112  {
113  $this->dimensions = $dimensions;
114 
115  return $this;
116  }
117 
118  public function build(): Image
119  {
120  return new ImageModel(
121  $this->url,
122  $this->dimensions instanceof AssetDimensionsBuilder ? $this->dimensions->build() : $this->dimensions,
123  $this->label
124  );
125  }
126 
127  public static function of(): ImageBuilder
128  {
129  return new self();
130  }
131 }
withDimensions(?AssetDimensions $dimensions)
withDimensionsBuilder(?AssetDimensionsBuilder $dimensions)