Labels   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromXML() 0 13 4
1
<?php
2
declare(strict_types=1);
3
4
namespace Bpost\BpostApiClient\Bpost;
5
6
use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
7
use SimpleXMLElement;
8
9
/**
10
 * Class Labels
11
 */
12
class Labels
13
{
14
    /**
15
     * @throws BpostInvalidValueException
16
     */
17
    public static function createFromXML(SimpleXMLElement $xml): array
18
    {
19
        $labels = [];
20
21
        if (isset($xml->label)) {
22
            foreach ($xml->label as $labelXml) {
23
                if ($labelXml instanceof \SimpleXMLElement) {
24
                    $labels[] = Label::createFromXML($labelXml);
25
                }
26
            }
27
        }
28
29
        return $labels;
30
    }
31
}