Completed
Pull Request — master (#133)
by Damian
20:49 queued 18:16
created

MigrationStep::__set_state()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\API\Value;
4
5
/**
6
 * @property-read string $type
7
 * @property-read array $dsl
8
 * @property-read array $context
9
 */
10
class MigrationStep extends AbstractValue
11
{
12
    protected $type;
13
    protected $dsl;
14
    protected $context;
15
16 65
    public function __construct($type, array $dsl = array(), array $context = array())
17
    {
18 65
        $this->type = $type;
19 65
        $this->dsl = $dsl;
20 65
        $this->context = $context;
21 65
    }
22
23
    /**
24
     * Allow the class to be serialized to php using var_export
25
     * @param array $data
26
     * @return static
27
     */
28
    public static function __set_state(array $data)
29
    {
30
        return new static(
31
            $data['type'],
32
            $data['dsl'],
33
            $data['context']
34
        );
35
    }
36
}
37