commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
AttributeDateTypeCollection.php
1 <?php
2 
3 declare(strict_types=1);
10 
13 use stdClass;
14 
22 {
30  public function add($value)
31  {
32  if (!$value instanceof AttributeDateType) {
33  throw new InvalidArgumentException();
34  }
35  $this->store($value);
36 
37  return $this;
38  }
39 
43  protected function mapper()
44  {
45  return function (?int $index): ?AttributeDateType {
46  $data = $this->get($index);
47  if ($data instanceof stdClass) {
49  $data = AttributeDateTypeModel::of($data);
50  $this->set($data, $index);
51  }
52 
53  return $data;
54  };
55  }
56 }