commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SearchIndexingConfigurationValuesModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use DateTimeImmutable;
18 use stdClass;
19 
24 {
29  protected $status;
30 
35  protected $lastModifiedAt;
36 
41  protected $lastModifiedBy;
42 
43 
47  public function __construct(
48  ?string $status = null,
49  ?DateTimeImmutable $lastModifiedAt = null,
51  ) {
52  $this->status = $status;
53  $this->lastModifiedAt = $lastModifiedAt;
54  $this->lastModifiedBy = $lastModifiedBy;
55  }
56 
63  public function getStatus()
64  {
65  if (is_null($this->status)) {
67  $data = $this->raw(self::FIELD_STATUS);
68  if (is_null($data)) {
69  return null;
70  }
71  $this->status = (string) $data;
72  }
73 
74  return $this->status;
75  }
76 
83  public function getLastModifiedAt()
84  {
85  if (is_null($this->lastModifiedAt)) {
87  $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
88  if (is_null($data)) {
89  return null;
90  }
91  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
92  if (false === $data) {
93  return null;
94  }
95  $this->lastModifiedAt = $data;
96  }
97 
98  return $this->lastModifiedAt;
99  }
100 
107  public function getLastModifiedBy()
108  {
109  if (is_null($this->lastModifiedBy)) {
111  $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
112  if (is_null($data)) {
113  return null;
114  }
115 
116  $this->lastModifiedBy = LastModifiedByModel::of($data);
117  }
118 
119  return $this->lastModifiedBy;
120  }
121 
122 
126  public function setStatus(?string $status): void
127  {
128  $this->status = $status;
129  }
130 
134  public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
135  {
136  $this->lastModifiedAt = $lastModifiedAt;
137  }
138 
143  {
144  $this->lastModifiedBy = $lastModifiedBy;
145  }
146 
147 
148  #[\ReturnTypeWillChange]
149  public function jsonSerialize()
150  {
151  $data = $this->toArray();
153  $data[SearchIndexingConfigurationValues::FIELD_LAST_MODIFIED_AT] = $data[SearchIndexingConfigurationValues::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
154  }
155  return (object) $data;
156  }
157 }
__construct(?string $status=null, ?DateTimeImmutable $lastModifiedAt=null, ?LastModifiedBy $lastModifiedBy=null)