Passed
Push — master ( b47dcf...3f2121 )
by Aleksandr
04:26 queued 49s
created

Offer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 5
eloc 9
dl 0
loc 28
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPrices() 0 6 3
A getSpecifications() 0 6 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
    public function getSpecifications()
29
    {
30
        if (empty($this->specifications)) {
31
            $this->specifications = new SpecificationCollection($this->owner, $this->ХарактеристикиТовара);
32
        }
33
        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
}