commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
FacetTermModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
20final class FacetTermModel extends JsonObjectModel implements FacetTerm
21{
26 protected $term;
27
32 protected $count;
33
38 protected $productCount;
39
40
44 public function __construct(
45 $term = null,
46 ?int $count = null,
47 ?int $productCount = null
48 ) {
49 $this->term = $term;
50 $this->count = $count;
51 $this->productCount = $productCount;
52 }
53
61 public function getTerm()
62 {
63 if (is_null($this->term)) {
65 $data = $this->raw(self::FIELD_TERM);
66 if (is_null($data)) {
67 return null;
68 }
69 $this->term = $data;
70 }
71
72 return $this->term;
73 }
74
81 public function getCount()
82 {
83 if (is_null($this->count)) {
85 $data = $this->raw(self::FIELD_COUNT);
86 if (is_null($data)) {
87 return null;
88 }
89 $this->count = (int) $data;
90 }
91
92 return $this->count;
93 }
94
102 public function getProductCount()
103 {
104 if (is_null($this->productCount)) {
106 $data = $this->raw(self::FIELD_PRODUCT_COUNT);
107 if (is_null($data)) {
108 return null;
109 }
110 $this->productCount = (int) $data;
111 }
112
113 return $this->productCount;
114 }
115
116
120 public function setTerm($term): void
121 {
122 $this->term = $term;
123 }
124
128 public function setCount(?int $count): void
129 {
130 $this->count = $count;
131 }
132
136 public function setProductCount(?int $productCount): void
137 {
138 $this->productCount = $productCount;
139 }
140}
__construct( $term=null, ?int $count=null, ?int $productCount=null)