Passed
Push — master ( 4e4741...4fd99d )
by Asmir
06:32 queued 03:40
created

ReadOnlyProperty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 1
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({"CLASS","PROPERTY"})
10
 *
11
 * @final
12
 */
13
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY)]
14
/* final */ class ReadOnlyProperty
15
{
16
    /**
17
     * @var bool
18
     */
19
    public $readOnly = true;
20
21
    public function __construct(array $values = [], bool $readOnly = true)
22
    {
23
        if (array_key_exists('value', $values)) {
24
            $readOnly = $values['value'];
25
        }
26
27
        if (array_key_exists('readOnly', $values)) {
28
            $readOnly = $values['readOnly'];
29
        }
30
31
        $this->readOnly =  $readOnly;
32
    }
33
}
34