Passed
Pull Request — master (#1320)
by
unknown
02:40
created

XmlMap::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
c 0
b 0
f 0
nc 3
nop 6
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Annotation;
6
7
/**
8
 * @Annotation
9
 * @Target({"PROPERTY","METHOD","ANNOTATION"})
10
 */
11
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
12
final class XmlMap extends XmlCollection
13
{
14
    /**
15
     * @var string
16
     */
17
    public $keyAttribute = '_key';
18
19
    public function __construct(array $values = [], string $keyAttribute = '_key', string $entry = 'entry', bool $inline = false, ?string $namespace = null, bool $skipWhenEmpty = true)
20
    {
21
        if ([] !== $values) {
22
            if (array_key_exists('keyAttribute', $values)) {
23
                $keyAttribute = $values['keyAttribute'];
24
            }
25
        }
26
27
        parent::__construct($values, $entry, $inline, $namespace, $skipWhenEmpty);
28
        $this->keyAttribute = $keyAttribute;
29
    }
30
}
31