commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ImageModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class ImageModel extends JsonObjectModel implements Image
21 {
26  protected $url;
27 
32  protected $dimensions;
33 
38  protected $label;
39 
40 
44  public function __construct(
45  ?string $url = null,
47  ?string $label = null
48  ) {
49  $this->url = $url;
50  $this->dimensions = $dimensions;
51  $this->label = $label;
52  }
53 
60  public function getUrl()
61  {
62  if (is_null($this->url)) {
64  $data = $this->raw(self::FIELD_URL);
65  if (is_null($data)) {
66  return null;
67  }
68  $this->url = (string) $data;
69  }
70 
71  return $this->url;
72  }
73 
80  public function getDimensions()
81  {
82  if (is_null($this->dimensions)) {
84  $data = $this->raw(self::FIELD_DIMENSIONS);
85  if (is_null($data)) {
86  return null;
87  }
88 
89  $this->dimensions = AssetDimensionsModel::of($data);
90  }
91 
92  return $this->dimensions;
93  }
94 
101  public function getLabel()
102  {
103  if (is_null($this->label)) {
105  $data = $this->raw(self::FIELD_LABEL);
106  if (is_null($data)) {
107  return null;
108  }
109  $this->label = (string) $data;
110  }
111 
112  return $this->label;
113  }
114 
115 
119  public function setUrl(?string $url): void
120  {
121  $this->url = $url;
122  }
123 
127  public function setDimensions(?AssetDimensions $dimensions): void
128  {
129  $this->dimensions = $dimensions;
130  }
131 
135  public function setLabel(?string $label): void
136  {
137  $this->label = $label;
138  }
139 }
__construct(?string $url=null, ?AssetDimensions $dimensions=null, ?string $label=null)
Definition: ImageModel.php:44
setDimensions(?AssetDimensions $dimensions)
Definition: ImageModel.php:127