Conditions | 6 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 6.3949 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 3 | public function getCustomAttributeXml(string $attribute): ?string |
|
37 | { |
||
38 | 3 | if (empty($this->{$attribute})) { |
|
39 | return null; |
||
40 | } |
||
41 | 3 | $xmlContent = ''; |
|
42 | 3 | if ($this->entityAttributes[$attribute]['type'] == 'array') { |
|
43 | 3 | foreach ($this->{$attribute} as $item) { |
|
44 | /* @var \PagOnline\XmlEntities\XmlEntityInterface $item */ |
||
45 | 3 | $xmlContent .= $item instanceof XmlEntityInterface ? $item->toXml($attribute) : ''; |
|
46 | } |
||
47 | } else { |
||
48 | $xmlContent .= $this->{$attribute} instanceof XmlEntityInterface ? $this->{$attribute}->toXml($attribute) : ''; |
||
49 | } |
||
50 | |||
51 | 3 | return $xmlContent; |
|
52 | } |
||
54 |