carono /
php-commerceml
| 1 | <?php |
||
| 2 | |||
| 3 | |||
| 4 | namespace Zenwalker\CommerceML\Model; |
||
| 5 | |||
| 6 | |||
| 7 | use Zenwalker\CommerceML\Collections\SpecificationCollection; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Class Offer |
||
| 11 | * |
||
| 12 | * @package Zenwalker\CommerceML\Model |
||
| 13 | * @property Price prices |
||
| 14 | * @property SpecificationCollection specifications |
||
| 15 | * @property \SimpleXMLElement ХарактеристикиТовара |
||
| 16 | */ |
||
| 17 | class Offer extends Simple |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var Price |
||
| 21 | */ |
||
| 22 | protected $prices = []; |
||
| 23 | protected $stockrooms = []; |
||
| 24 | protected $specifications = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return array|SpecificationCollection |
||
| 28 | */ |
||
| 29 | 1 | public function getSpecifications() |
|
| 30 | { |
||
| 31 | 1 | if (empty($this->specifications)) { |
|
| 32 | 1 | $this->specifications = new SpecificationCollection($this->owner, $this->ХарактеристикиТовара); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 33 | } |
||
| 34 | 1 | return $this->specifications; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return Price |
||
| 39 | */ |
||
| 40 | 1 | public function getPrices() |
|
| 41 | { |
||
| 42 | 1 | if ($this->xml && empty($this->prices)) { |
|
| 43 | 1 | $this->prices = new Price($this->owner, $this->xml->Цены); |
|
| 44 | } |
||
| 45 | 1 | return $this->prices; |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | public function getStockrooms() |
|
| 49 | { |
||
| 50 | 1 | if ($this->xml && empty($this->stockrooms)) { |
|
| 51 | 1 | foreach ($this->xml->Склад as $stockroom) { |
|
| 52 | 1 | $this->stockrooms[] = new Stockroom($this->owner, $stockroom); |
|
| 53 | } |
||
| 54 | } |
||
| 55 | 1 | return $this->stockrooms; |
|
| 56 | } |
||
| 57 | } |