1: <?php
2: namespace Datadepo\Api\Structures;
3:
4: /**
5: * @property-read string $supplier
6: * @property-read string $type
7: * @property-read string $name
8: * @property-read integer $count
9: * @property-read ImageLine[] $images
10: */
11: class RelatedLine extends AbstractStructure
12: {
13:
14: /** @var string */
15: private $_images = NULL;
16:
17: /**
18: * @param array $data
19: */
20: public function __construct($data)
21: {
22: $this->data = $data;
23: }
24:
25: /**
26: * @return string
27: */
28: public function getPrimary()
29: {
30: return $this->data->primary;
31: }
32:
33: /**
34: * @return string
35: */
36: public function getJson()
37: {
38: return json_encode($this->data);
39: }
40:
41: /**
42: * @return string
43: */
44: public function getSupplier()
45: {
46: return $this->data->supplier;
47: }
48:
49: /**
50: * @return string
51: */
52: public function getType()
53: {
54: return $this->data->type;
55: }
56:
57: /**
58: * @return string
59: */
60: public function getName()
61: {
62: return $this->data->name;
63: }
64:
65: /**
66: * @return integer
67: */
68: public function getCount()
69: {
70: return $this->data->count;
71: }
72:
73: /**
74: * @return ImageLine[]
75: */
76: public function getImages()
77: {
78: if ($this->_images === NULL) {
79: $this->_images = array();
80: if (property_exists($this->data, 'images')) {
81: foreach ($this->data->images as $idName => $data) {
82: $this->_images[$idName] = new ImageLine($data);
83: }
84: }
85: }
86: return $this->_images;
87: }
88:
89:
90: }