1: <?php
2: namespace Datadepo\Api\Structures;
3:
4: /**
5: * @property-read string|FALSE @codeMoved
6: * @property-read bool $deleted
7: * @property-read string $project
8: * @property-read string $name
9: * @property-read string $nameSub
10: * @property-read string $pairValue
11: * @property-read string $ean
12: * @property-read string $isbn
13: * @property-read string $description
14: * @property-read integer $categoryId
15: * @property-read string $jsonImages
16: * @property-read string $checksumImages
17: * @property-read ImageLine[] $images
18: * @property-read string $jsonParameters
19: * @property-read string $checksumParameters
20: * @property-read ParameterLine[] $parameters
21: * @property-read string $jsonRelated
22: * @property-read string $checksumRelated
23: * @property-read RelatedLine[] $related
24: */
25: class DataLine extends AbstractStructure
26: {
27:
28: /** @var string */
29: private $_jsonImages = FALSE;
30:
31: /** @var string */
32: private $_images = NULL;
33:
34: /** @var string */
35: private $_jsonParameters = FALSE;
36:
37: /** @var string */
38: private $_parameters = NULL;
39:
40: /** @var string */
41: private $_related = NULL;
42:
43: /** @var string */
44: private $_jsonRelated = FALSE;
45:
46: /**
47: * @return string
48: */
49: public function getPrimary()
50: {
51: return $this->data->code;
52: }
53:
54: /**
55: * @return string|FALSE
56: */
57: public function getCodeMoved()
58: {
59: return property_exists($this->data, 'codeMoved') ? $this->data->codeMoved : FALSE;
60: }
61:
62: /**
63: * @return bool
64: */
65: public function getDeleted()
66: {
67: return $this->getCodeMoved() !== FALSE;
68: }
69:
70: /**
71: * @return string
72: */
73: public function getProject()
74: {
75: return $this->data->project;
76: }
77:
78: /**
79: * @return string
80: */
81: public function getName()
82: {
83: return $this->data->name;
84: }
85:
86: /**
87: * @return string
88: */
89: public function getNameSub()
90: {
91: return $this->data->nameSub;
92: }
93:
94: /**
95: * @return string
96: */
97: public function getPairValue()
98: {
99: return $this->data->pairValue;
100: }
101:
102: /**
103: * @return string
104: */
105: public function getEan()
106: {
107: return $this->data->ean;
108: }
109:
110: /**
111: * @return string
112: */
113: public function getIsbn()
114: {
115: return $this->data->isbn;
116: }
117:
118: /**
119: * @return string
120: */
121: public function getDescription()
122: {
123: return $this->data->description;
124: }
125:
126: /**
127: * @return integer
128: */
129: public function getCategoryId()
130: {
131: return $this->data->categoryId;
132: }
133:
134: /**
135: * @return string
136: */
137: public function getJsonImages()
138: {
139: if ($this->_jsonImages === FALSE) {
140: $this->_jsonImages = property_exists($this->data, 'images') ? json_encode($this->data->images) : NULL;
141: }
142: return $this->_jsonImages;
143: }
144:
145: /**
146: * @return string
147: */
148: public function getChecksumImages()
149: {
150: return $this->getJsonImages() !== NULL ? md5($this->getJsonImages()) : NULL;
151: }
152:
153: /**
154: * @return ImageLine[]
155: */
156: public function getImages()
157: {
158: if ($this->_images === NULL) {
159: $this->_images = array();
160: if (property_exists($this->data, 'images')) {
161: foreach ($this->data->images as $idName => $data) {
162: $this->_images[$idName] = new ImageLine($data);
163: }
164: }
165: }
166: return $this->_images;
167: }
168:
169: /**
170: * @return string
171: */
172: public function getJsonParameters()
173: {
174: if ($this->_jsonParameters === FALSE) {
175: $this->_jsonParameters = property_exists($this->data, 'parameters') ? json_encode($this->data->parameters) : NULL;
176: }
177: return $this->_jsonParameters;
178: }
179:
180: /**
181: * @return string
182: */
183: public function getChecksumParameters()
184: {
185: return $this->getJsonParameters() !== NULL ? md5($this->getJsonParameters()) : NULL;
186: }
187:
188: /**
189: * @return ParameterLine[]
190: */
191: public function getParameters()
192: {
193: if ($this->_parameters === NULL) {
194: $this->_parameters = array();
195: if (property_exists($this->data, 'parameters')) {
196: foreach ($this->data->parameters as $idName => $data) {
197: $this->_parameters[$idName] = new ParameterLine($data);
198: }
199: }
200: }
201: return $this->_parameters;
202: }
203:
204: /**
205: * @return string
206: */
207: public function getJsonRelated()
208: {
209: if ($this->_jsonRelated === FALSE) {
210: $this->_jsonRelated = property_exists($this->data, 'related') ? json_encode($this->data->related) : NULL;
211: }
212: return $this->_jsonRelated;
213: }
214:
215: /**
216: * @return string
217: */
218: public function getChecksumRelated()
219: {
220: return $this->getJsonRelated() !== NULL ? md5($this->getJsonRelated()) : NULL;
221: }
222:
223: /**
224: * @return RelatedLine[]
225: */
226: public function getRelated()
227: {
228: if ($this->_related === NULL) {
229: $this->_related = array();
230: if (property_exists($this->data, 'related')) {
231: foreach ($this->data->related as $idName => $data) {
232: $this->_related[$idName] = new RelatedLine($data);
233: }
234: }
235: }
236: return $this->_related;
237: }
238:
239:
240: }