commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
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
60 public function getTerm()
61 {
62 if (is_null($this->term)) {
64 $data = $this->raw(self::FIELD_TERM);
65 if (is_null($data)) {
66 return null;
67 }
68 $this->term = $data;
69 }
70
71 return $this->term;
72 }
73
80 public function getCount()
81 {
82 if (is_null($this->count)) {
84 $data = $this->raw(self::FIELD_COUNT);
85 if (is_null($data)) {
86 return null;
87 }
88 $this->count = (int) $data;
89 }
90
91 return $this->count;
92 }
93
101 public function getProductCount()
102 {
103 if (is_null($this->productCount)) {
105 $data = $this->raw(self::FIELD_PRODUCT_COUNT);
106 if (is_null($data)) {
107 return null;
108 }
109 $this->productCount = (int) $data;
110 }
111
112 return $this->productCount;
113 }
114
115
119 public function setTerm($term): void
120 {
121 $this->term = $term;
122 }
123
127 public function setCount(?int $count): void
128 {
129 $this->count = $count;
130 }
131
135 public function setProductCount(?int $productCount): void
136 {
137 $this->productCount = $productCount;
138 }
139}
__construct( $term=null, ?int $count=null, ?int $productCount=null)