Completed
Pull Request — master (#1320)
by
unknown
03:30 queued 13s
created

XmlCollection   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
c 0
b 0
f 0
dl 0
loc 46
rs 10
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 24 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Annotation;
6
7
abstract class XmlCollection
8
{
9
    /**
10
     * @var string
11
     */
12
    public $entry = 'entry';
13
14
    /**
15
     * @var bool
16
     */
17
    public $inline = false;
18
19
    /**
20
     * @var string|null
21
     */
22
    public $namespace = null;
23
24
    /**
25
     * @var bool
26
     */
27
    public $skipWhenEmpty = true;
28
29
    public function __construct(array $values = [], string $entry = 'entry', bool $inline = false, ?string $namespace = null, bool $skipWhenEmpty = true)
30
    {
31
        if (0 !== count($values)) {
32
            if (array_key_exists('entry', $values)) {
33
                $entry = $values['entry'];
34
            }
35
36
            if (array_key_exists('inline', $values)) {
37
                $inline = $values['inline'];
38
            }
39
40
            if (array_key_exists('namespace', $values)) {
41
                $namespace = $values['namespace'];
42
            }
43
44
            if (array_key_exists('skipWhenEmpty', $values)) {
45
                $skipWhenEmpty = $values['skipWhenEmpty'];
46
            }
47
        }
48
49
        $this->entry = $entry;
50
        $this->inline = $inline;
51
        $this->namespace = $namespace;
52
        $this->skipWhenEmpty = $skipWhenEmpty;
53
    }
54
}
55