|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace vfalies\tmdb\Results; |
|
4
|
|
|
|
|
5
|
|
|
use vfalies\tmdb\Abstracts\Results; |
|
6
|
|
|
use vfalies\tmdb\Tmdb; |
|
7
|
|
|
use vfalies\tmdb\Interfaces\Results\PeopleResultsInterface; |
|
8
|
|
|
use vfalies\tmdb\Exceptions\NotYetImplementedException; |
|
9
|
|
|
|
|
10
|
|
|
class People extends Results implements PeopleResultsInterface |
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
protected $adult = null; |
|
14
|
|
|
protected $known_for = null; |
|
15
|
|
|
protected $name = null; |
|
16
|
|
|
protected $popularity = null; |
|
17
|
|
|
protected $profile_path = null; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Constructor |
|
21
|
|
|
* @param \vfalies\tmdb\Tmdb $tmdb |
|
22
|
|
|
* @param \stdClass $result |
|
23
|
|
|
* @throws \Exception |
|
24
|
|
|
*/ |
|
25
|
6 |
|
public function __construct(Tmdb $tmdb, \stdClass $result) |
|
26
|
|
|
{ |
|
27
|
6 |
|
parent::__construct($tmdb, $result); |
|
28
|
|
|
|
|
29
|
|
|
// Populate data |
|
30
|
6 |
|
$this->id = $this->data->id; |
|
|
|
|
|
|
31
|
6 |
|
$this->adult = $this->data->adult; |
|
32
|
6 |
|
$this->known_for = $this->data->known_for; |
|
33
|
6 |
|
$this->name = $this->data->name; |
|
34
|
6 |
|
$this->popularity = $this->data->popularity; |
|
35
|
6 |
|
$this->profile_path = $this->data->profile_path; |
|
36
|
6 |
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function getId() |
|
39
|
|
|
{ |
|
40
|
1 |
|
return (int) $this->id; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
1 |
|
public function getAdult() |
|
44
|
|
|
{ |
|
45
|
1 |
|
return $this->adult; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @codeCoverageIgnore |
|
50
|
|
|
* @throws NotYetImplementedException |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getKnownFor() |
|
53
|
|
|
{ |
|
54
|
|
|
throw new NotYetImplementedException; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
1 |
|
public function getName() |
|
58
|
|
|
{ |
|
59
|
1 |
|
return $this->name; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
public function getPopularity() |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->popularity; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
1 |
|
public function getProfilePath() |
|
68
|
|
|
{ |
|
69
|
1 |
|
return $this->profile_path; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: