Passed
Push — master ( 4e4741...4fd99d )
by Asmir
03:38 queued 01:04
created

AccessorOrder::__construct()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 8
nop 3
dl 0
loc 16
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
 * 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 (array_key_exists('value', $values)) {
32
            $order = $values['value'];
33
        }
34
35
        if (array_key_exists('order', $values)) {
36
            $order = $values['order'];
37
        }
38
39
        if (array_key_exists('custom', $values)) {
40
            $custom = $values['custom'];
41
        }
42
43
        $this->order = $order;
44
        $this->custom = $custom;
45
    }
46
}
47