Passed
Pull Request — master (#1320)
by
unknown
03:01
created

Expose::__construct()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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