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

MaxDepth   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
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 MaxDepth
13
{
14
    /**
15
     * @Required
16
     * @var int
17
     */
18
    public $depth;
19
20
    public function __construct(array $values = [], int $depth = 0)
21
    {
22
        if (array_key_exists('value', $values)) {
23
            $depth = $values['value'];
24
        }
25
26
        if (array_key_exists('depth', $values)) {
27
            $depth = $values['depth'];
28
        }
29
30
        $this->depth = $depth;
31
    }
32
}
33