Passed
Pull Request — master (#1332)
by Asmir
02:29
created

XmlAttribute::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 4
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
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 XmlAttribute
13
{
14
    /**
15
     * @var string|null
16
     */
17
    public $namespace = null;
18
19
    public function __construct(array $values = [], ?string $namespace = null)
20
    {
21
        if (array_key_exists('value', $values)) {
22
            $namespace = $values['value'];
23
        }
24
25
        if (array_key_exists('namespace', $values)) {
26
            $namespace = $values['namespace'];
27
        }
28
29
        $this->namespace = $namespace;
30
    }
31
}
32