Stockroom::getPackageStockroom()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 6
cp 0.8333
rs 10
cc 2
nc 2
nop 0
crap 2.0185
1
<?php
2
3
namespace Zenwalker\CommerceML\Model;
4
5
class Stockroom extends Simple
6
{
7
    private $_packageStockroom;
8
9 1
    public function getPackageStockroom()
10
    {
11 1
        if ($this->_packageStockroom) {
12
            return $this->_packageStockroom;
13
        }
14 1
        $id = $this->id;
15 1
        $xml = current($this->owner->offerPackage->xpath('//c:Склад[c:Ид = :id]', ['id' => $id]));
16 1
        return $this->_packageStockroom = new static($this->owner, $xml);
17
    }
18
19 1
    public function propertyAliases()
20
    {
21 1
        return array_merge(parent::propertyAliases(), [
22 1
            'ИдСклада' => 'id',
23
            'КоличествоНаСкладе' => 'count',
24
        ]);
25
    }
26
}