commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AssetSourceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class AssetSourceModel extends JsonObjectModel implements AssetSource
21 {
26  protected $uri;
27 
32  protected $key;
33 
38  protected $dimensions;
39 
44  protected $contentType;
45 
46 
50  public function __construct(
51  ?string $uri = null,
52  ?string $key = null,
54  ?string $contentType = null
55  ) {
56  $this->uri = $uri;
57  $this->key = $key;
58  $this->dimensions = $dimensions;
59  $this->contentType = $contentType;
60  }
61 
66  public function getUri()
67  {
68  if (is_null($this->uri)) {
70  $data = $this->raw(self::FIELD_URI);
71  if (is_null($data)) {
72  return null;
73  }
74  $this->uri = (string) $data;
75  }
76 
77  return $this->uri;
78  }
79 
84  public function getKey()
85  {
86  if (is_null($this->key)) {
88  $data = $this->raw(self::FIELD_KEY);
89  if (is_null($data)) {
90  return null;
91  }
92  $this->key = (string) $data;
93  }
94 
95  return $this->key;
96  }
97 
104  public function getDimensions()
105  {
106  if (is_null($this->dimensions)) {
108  $data = $this->raw(self::FIELD_DIMENSIONS);
109  if (is_null($data)) {
110  return null;
111  }
112 
113  $this->dimensions = AssetDimensionsModel::of($data);
114  }
115 
116  return $this->dimensions;
117  }
118 
123  public function getContentType()
124  {
125  if (is_null($this->contentType)) {
127  $data = $this->raw(self::FIELD_CONTENT_TYPE);
128  if (is_null($data)) {
129  return null;
130  }
131  $this->contentType = (string) $data;
132  }
133 
134  return $this->contentType;
135  }
136 
137 
141  public function setUri(?string $uri): void
142  {
143  $this->uri = $uri;
144  }
145 
149  public function setKey(?string $key): void
150  {
151  $this->key = $key;
152  }
153 
157  public function setDimensions(?AssetDimensions $dimensions): void
158  {
159  $this->dimensions = $dimensions;
160  }
161 
165  public function setContentType(?string $contentType): void
166  {
167  $this->contentType = $contentType;
168  }
169 }
__construct(?string $uri=null, ?string $key=null, ?AssetDimensions $dimensions=null, ?string $contentType=null)