| Conditions | 5 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php namespace Zenwalker\CommerceML\Model; |
||
| 27 | 2 | public function getValueModel() |
|
| 28 | { |
||
| 29 | 2 | if ($this->productId && !$this->_value && ($product = $this->owner->catalog->getById($this->productId))) { |
|
| 30 | 2 | $xpath = "c:ЗначенияСвойств/c:ЗначенияСвойства[c:Ид = '{$this->id}']"; |
|
| 31 | 2 | $valueXml = $product->xpath($xpath)[0]; |
|
| 32 | 2 | $value = $this->_value = (string)$valueXml->Значение; |
|
|
|
|||
| 33 | 2 | if ($property = $this->owner->classifier->getReferenceBookValueById($value)) { |
|
| 34 | 1 | $this->_value = new Simple($this->owner, $property); |
|
| 35 | } else { |
||
| 36 | 1 | $this->_value = new Simple($this->owner, $valueXml); |
|
| 37 | } |
||
| 38 | } |
||
| 39 | 2 | return $this->_value; |
|
| 40 | } |
||
| 46 | } |