PeopleTVShowCrew::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 12
nc 2
nop 2
dl 0
loc 16
ccs 13
cts 13
cp 1
crap 2
rs 9.8666
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * This file is part of the Tmdb package.
5
 *
6
 * (c) Vincent Faliès <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @author Vincent Faliès <[email protected]>
12
 * @copyright Copyright (c) 2017
13
 */
14
15
namespace VfacTmdb\Results;
16
17
use VfacTmdb\Abstracts\Results;
18
use VfacTmdb\Interfaces\TmdbInterface;
19
20
/**
21
 * Class to manipulate a people tvshow crew result
22
 * @package Tmdb
23
 * @author Vincent Faliès <[email protected]>
24
 * @copyright Copyright (c) 2017
25
 */
26
class PeopleTVShowCrew extends Results
27
{
28
29
    /**
30
     * Credit Id
31
     * @var string
32
     */
33
    protected $credit_id = null;
34
35
    /**
36
     * name
37
     * @var string
38
     */
39
    protected $name = null;
40
41
    /**
42
     * Image poster path
43
     * @var string
44
     */
45
    protected $poster_path = null;
46
47
    /**
48
     * original name
49
     * @var string
50
     */
51
    protected $original_name = null;
52
53
    /**
54
     * First air date
55
     * @var string
56
     */
57
    protected $first_air_date = null;
58
59
    /**
60
     * Id
61
     * @var int
62
     */
63
    protected $id = null;
64
65
    /**
66
     * Department
67
     * @var string
68
     */
69
    protected $department = null;
70
71
    /**
72
     * Job
73
     * @var string
74
     */
75
    protected $job = null;
76
77
    /**
78
     * Episode count
79
     * @var int
80
     */
81
    protected $episode_count = null;
82
83
    /**
84
     * Constructor
85
     * @param TmdbInterface $tmdb
86
     * @param \stdClass $result
87
     */
88 30
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
89
    {
90 30
        if (!isset($result->episode_count)) {
91 3
            $result->episode_count = null;
92
        }
93 30
        parent::__construct($tmdb, $result);
94
95 30
        $this->id             = $this->data->id;
96 30
        $this->episode_count  = $this->data->episode_count;
97 30
        $this->department     = $this->data->department;
98 30
        $this->job            = $this->data->job;
99 30
        $this->credit_id      = $this->data->credit_id;
100 30
        $this->original_name  = $this->data->original_name;
101 30
        $this->name           = $this->data->name;
102 30
        $this->poster_path    = $this->data->poster_path;
103 30
        $this->first_air_date = $this->data->first_air_date;
104 30
    }
105
106
    /**
107
     * Get Id
108
     * @return int
109
     */
110 3
    public function getId() : int
111
    {
112 3
        return (int) $this->id;
113
    }
114
115
    /**
116
     * Get credit Id
117
     * @return string
118
     */
119 3
    public function getCreditId() : string
120
    {
121 3
        return $this->credit_id;
122
    }
123
124
    /**
125
     * Get department name
126
     * @return string
127
     */
128 3
    public function getDepartment() : string
129
    {
130 3
        return $this->department;
131
    }
132
133
    /**
134
     * Get job
135
     * @return string
136
     */
137 3
    public function getJob() : string
138
    {
139 3
        return $this->job;
140
    }
141
142
    /**
143
     * Get name
144
     * @return string
145
     */
146 3
    public function getName() : string
147
    {
148 3
        return $this->name;
149
    }
150
151
    /**
152
     * Get original name
153
     * @return string
154
     */
155 3
    public function getOriginalName() : string
156
    {
157 3
        return $this->original_name;
158
    }
159
160
    /**
161
     * Get poster path
162
     * @return string
163
     */
164 3
    public function getPosterPath() : string
165
    {
166 3
        return $this->poster_path;
167
    }
168
169
    /**
170
     * Get first air date
171
     * @return string
172
     */
173 3
    public function getFirstAirDate() : string
174
    {
175 3
        return $this->first_air_date;
176
    }
177
178
    /**
179
     * Episode count
180
     * @return int
181
     */
182 3
    public function getEpisodeCount() : int
183
    {
184 3
        return $this->episode_count;
185
    }
186
}
187