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

Interview   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Happyr\ApiClient\Model\Interview;
4
5
use Happyr\ApiClient\Model\CreatableFromArray;
6
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
final class Interview implements CreatableFromArray
11
{
12
    /**
13
     * @var array with keys as profile ids and each profile has a name, statements and questions
14
     */
15
    private $profiles;
16
17
    /**
18
     * @var string
19
     */
20
    private $description;
21
22
    /**
23
     * @var bool
24
     */
25
    private $complete;
26
27
    /**
28
     * @param array  $profiles
29
     * @param string $description
30
     * @param bool   $complete
31
     */
32
    private function __construct(array $profiles, $description, $complete)
33
    {
34
        $this->profiles = $profiles;
35
        $this->description = $description;
36
        $this->complete = $complete;
37
    }
38
39
    /**
40
     * @param array $data
41
     *
42
     * @return
43
     */
44
    public static function createFromArray(array $data)
45
    {
46
        return new self($data['data']['profiles'], $data['data']['description'], $data['data']['complete']);
47
    }
48
49
    /**
50
     * This is allow legacy code use the interview object.
51
     *
52
     * @return array
53
     */
54
    public function toArray()
55
    {
56
        return [
57
            'profiles' => $this->profiles,
58
            'description' => $this->description,
59
            'complete' => $this->complete,
60
        ];
61
    }
62
63
    /**
64
     * @return array
65
     */
66
    public function getProfiles()
67
    {
68
        return $this->profiles;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getDescription()
75
    {
76
        return $this->description;
77
    }
78
79
    /**
80
     * @return bool
81
     */
82
    public function isComplete()
83
    {
84
        return $this->complete;
85
    }
86
}
87