Passed
Push — master ( 4c85b9...e180ca )
by Arthur
36:55
created

ClientState   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 44
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A __construct() 0 10 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 21.02.19
6
 * Time: 18:34
7
 */
8
9
namespace Modules\Client\Entities;
10
11
12
class ClientState
13
{
14
    public $type;
15
    public $paused;
16
    public $stoppable;
17
    public $scriptId;
18
    public $machineId;
19
    public $scriptConfig;
20
    public $proxy;
21
    public $credentials;
22
23
    /**
24
     * ClientState constructor.
25
     * @param $type
26
     * @param $paused
27
     * @param $stoppable
28
     * @param $scriptId
29
     * @param $machineId
30
     * @param $scriptConfig
31
     * @param $proxy
32
     * @param $credentials
33
     */
34
    private function __construct(string $type, bool $paused, bool $stoppable, string $scriptId, string $machineId, ?array $scriptConfig, ?array $proxy, ?array $credentials)
35
    {
36
        $this->type = $type;
37
        $this->paused = $paused;
38
        $this->stoppable = $stoppable;
39
        $this->scriptId = $scriptId;
40
        $this->machineId = $machineId;
41
        $this->scriptConfig = $scriptConfig;
42
        $this->proxy = $proxy;
43
        $this->credentials = $credentials;
44
    }
45
46
    public static function create(array $state){
47
        return new ClientState(
48
            $state['type'],
49
            $state['paused'],
50
            $state['stoppable'],
51
            $state['scriptId'],
52
            $state['machineId'],
53
            $state['script_config'] ??null,
54
            $state['proxy'] ?? null,
55
            $state['credentials'] ?? null
56
        );
57
    }
58
59
60
}