commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
SearchKeywordsModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class SearchKeywordsModel extends JsonObjectModel implements SearchKeywords
21 {
25  public function __construct(
26  ) {
27  }
28 
29 
30 
31 
35  public function by(string $key)
36  {
37  $data = $this->raw($key);
38  if (is_null($data)) {
39  return null;
40  }
41  if (preg_match(SearchKeywords::FIELD_PATTERN0, $key) === 1) {
43  return new SearchKeywordCollection($data);
44  }
45 
46  return $data;
47  }
48 }