commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
FacetTermModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final 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 
58  public function getTerm()
59  {
60  if (is_null($this->term)) {
62  $data = $this->raw(self::FIELD_TERM);
63  if (is_null($data)) {
64  return null;
65  }
66  $this->term = $data;
67  }
68 
69  return $this->term;
70  }
71 
76  public function getCount()
77  {
78  if (is_null($this->count)) {
80  $data = $this->raw(self::FIELD_COUNT);
81  if (is_null($data)) {
82  return null;
83  }
84  $this->count = (int) $data;
85  }
86 
87  return $this->count;
88  }
89 
94  public function getProductCount()
95  {
96  if (is_null($this->productCount)) {
98  $data = $this->raw(self::FIELD_PRODUCT_COUNT);
99  if (is_null($data)) {
100  return null;
101  }
102  $this->productCount = (int) $data;
103  }
104 
105  return $this->productCount;
106  }
107 
108 
112  public function setTerm($term): void
113  {
114  $this->term = $term;
115  }
116 
120  public function setCount(?int $count): void
121  {
122  $this->count = $count;
123  }
124 
128  public function setProductCount(?int $productCount): void
129  {
130  $this->productCount = $productCount;
131  }
132 }
__construct( $term=null, ?int $count=null, ?int $productCount=null)