Passed
Push — master ( 3c5f34...4a3ec6 )
by Asmir
48s queued 12s
created

PropertyMetadata::unserializeFromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Metadata;
6
7
/**
8
 * Base class for property metadata.
9
 *
10
 * This class is intended to be extended to add your application specific
11
 * properties, and flags.
12
 *
13
 * @author Johannes M. Schmitt <[email protected]>
14
 */
15
class PropertyMetadata implements \Serializable
16
{
17
    use SerializationHelper;
18
19
    /**
20
     * @var string
21
     */
22
    public $class;
23
24
    /**
25
     * @var string
26
     */
27 3
    public $name;
28
29 3
    public function __construct(string $class, string $name)
30 3
    {
31 3
        $this->class = $class;
32
        $this->name = $name;
33
    }
34
35
    protected function serializeToArray(): array
36
    {
37
        return [
38
            $this->class,
39
            $this->name,
40 1
        ];
41
    }
42 1
43 1
    protected function unserializeFromArray(array $data): void
44 1
    {
45
        [$this->class, $this->name] = $data;
46
    }
47
}
48