Entity::__set_state()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 9.6667
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
namespace BrainExe\Expression;
4
5
class Entity
6
{
7
8
    /**
9
     * @var int
10
     */
11
    public $expressionId;
12
13
    /**
14
     * @var string[]
15
     */
16
    public $conditions = [];
17
18
    /**
19
     * @var string[]
20
     */
21
    public $actions = [];
22
23
    /**
24
     * @var mixed[]
25
     */
26
    public $payload = [];
27
28
    /**
29
     * @var string
30
     */
31
    public $compiledCondition;
32
33
    /**
34
     * @var bool
35
     */
36
    public $enabled = true;
37
38
    /**
39
     * @param array $array
40
     * @return static
41
     */
42
    public static function __set_state(array $array)
43
    {
44
        $entity = new static();
45
        foreach ($array as $key => $value) {
46
            $entity->$key = $value;
47
        }
48
49
        return $entity;
50
    }
51
}
52