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

AccessorOrder::__construct()   A

Complexity

Conditions 5
Paths 9

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 9
c 0
b 0
f 0
nc 9
nop 3
dl 0
loc 18
rs 9.6111
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Annotation;
6
7
/**
8
 * Controls the order of properties in a class.
9
 *
10
 * @Annotation
11
 * @Target("CLASS")
12
 *
13
 * @author Johannes M. Schmitt <[email protected]>
14
 */
15
#[\Attribute(\Attribute::TARGET_CLASS)]
16
final class AccessorOrder
17
{
18
    /**
19
     * @Required
20
     * @var string|null
21
     */
22
    public $order = null;
23
24
    /**
25
     * @var array<string>
26
     */
27
    public $custom = [];
28
29
    public function __construct(array $values = [], ?string $order = null, array $custom = [])
30
    {
31
        if (0 !== count($values)) {
32
            if (array_key_exists('value', $values)) {
33
                $order = $values['value'];
34
            }
35
36
            if (array_key_exists('order', $values)) {
37
                $order = $values['order'];
38
            }
39
40
            if (array_key_exists('custom', $values)) {
41
                $custom = $values['custom'];
42
            }
43
        }
44
45
        $this->order = $order;
46
        $this->custom = $custom;
47
    }
48
}
49