Completed
Push — master ( 3cb300...cba459 )
by Tobias
03:38
created

SelfDescription::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Happyr\ApiClient\Model\Match;
4
5
use Happyr\ApiClient\Model\CreatableFromArray;
6
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
final class SelfDescription implements CreatableFromArray
11
{
12
    /**
13
     * @var array
14
     */
15
    private $profiles;
16
17
    /**
18
     * @var array
19
     */
20
    private $strongDescription;
21
22
    /**
23
     * @var array
24
     */
25
    private $weakDescription;
26
27
    /**
28
     * @param array $profiles
29
     * @param array $strongDescription
30
     * @param array $weakDescription
31
     */
32
    public function __construct(array $profiles, array $strongDescription, array $weakDescription)
33
    {
34
        $this->profiles = $profiles;
35
        $this->strongDescription = $strongDescription;
36
        $this->weakDescription = $weakDescription;
37
    }
38
39
    /**
40
     * @param array $data
41
     *
42
     * @return
43
     */
44
    public static function createFromArray(array $data)
45
    {
46
        return new self(
47
            $data['data']['profiles'],
48
            $data['data']['description']['strong'],
49
            $data['data']['description']['weak']
50
        );
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    public function getProfiles()
57
    {
58
        return $this->profiles;
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getStrongDescription()
65
    {
66
        return $this->strongDescription;
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getWeakDescription()
73
    {
74
        return $this->weakDescription;
75
    }
76
}
77