Passed
Push — master ( 3ff747...952456 )
by Aleksandr
01:46
created

Offer::getSpecifications()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
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 $specifications = [];
24
25
    /**
26
     * @return array|SpecificationCollection
27
     */
28 1
    public function getSpecifications()
29
    {
30 1
        if (empty($this->specifications)) {
31 1
            $this->specifications = new SpecificationCollection($this->owner, $this->ХарактеристикиТовара);
32
        }
33 1
        return $this->specifications;
34
    }
35
36
    /**
37
     * @return Price
38
     */
39 1
    public function getPrices()
40
    {
41 1
        if ($this->xml && empty($this->prices)) {
42 1
            $this->prices = new Price($this->owner, $this->xml->Цены);
43
        }
44 1
        return $this->prices;
45
    }
46
}