Passed
Branch release/1.5.0 (5f009d)
by vincent
05:05
created

People   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 98
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getId() 0 4 1
A getAdult() 0 4 1
A getName() 0 4 1
A getPopularity() 0 4 1
A getProfilePath() 0 4 1
1
<?php
2
/**
3
 * This file is part of the Tmdb package.
4
 *
5
 * (c) Vincent Faliès <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
11
 * @author Vincent Faliès <[email protected]>
12
 * @copyright Copyright (c) 2017
13
 */
14
15
16
namespace vfalies\tmdb\Results;
17
18
use vfalies\tmdb\Abstracts\Results;
19
use vfalies\tmdb\Interfaces\Results\PeopleResultsInterface;
20
use vfalies\tmdb\Exceptions\NotYetImplementedException;
21
use vfalies\tmdb\Interfaces\TmdbInterface;
22
23
/**
24
 * People class
25
 * @package Tmdb
26
 * @author Vincent Faliès <[email protected]>
27
 * @copyright Copyright (c) 2017
28
 */
29
class People extends Results implements PeopleResultsInterface
30
{
31
    /**
32
     * Adult
33
     * @var string
34
     */
35
    protected $adult        = null;
36
    /**
37
     * People known for
38
     * @var array
39
     */
40
    protected $known_for    = null;
41
    /**
42
     * People name
43
     * @var string
44
     */
45
    protected $name         = null;
46
    /**
47
     * Popularity
48
     * @var int
49
     */
50
    protected $popularity   = null;
51
    /**
52
     * Image profile path
53
     * @var string
54
     */
55
    protected $profile_path = null;
56
    /**
57
     * Id
58
     * @var int
59
     */
60
    protected $id           = null;
61
62
    /**
63
     * Constructor
64
     * @param \vfalies\tmdb\Interfaces\TmdbInterface $tmdb
65
     * @param \stdClass $result
66
     * @throws \Exception
67
     */
68 6
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
69
    {
70 6
        parent::__construct($tmdb, $result);
71
72
        // Populate data
73 6
        $this->id           = $this->data->id;
74 6
        $this->adult        = $this->data->adult;
75 6
        $this->known_for    = $this->data->known_for;
76 6
        $this->name         = $this->data->name;
77 6
        $this->popularity   = $this->data->popularity;
78 6
        $this->profile_path = $this->data->profile_path;
79 6
    }
80
81
    /**
82
     * Get Id
83
     * @return int
84
     */
85 1
    public function getId()
86
    {
87 1
        return (int) $this->id;
88
    }
89
90
    /**
91
     * Get Adult
92
     * @return string
93
     */
94 1
    public function getAdult()
95
    {
96 1
        return $this->adult;
97
    }
98
99
    /**
100
     * People name
101
     * @return string
102
     */
103 1
    public function getName()
104
    {
105 1
        return $this->name;
106
    }
107
108
    /**
109
     * People Popularity
110
     * @return string
111
     */
112 1
    public function getPopularity()
113
    {
114 1
        return $this->popularity;
115
    }
116
117
    /**
118
     * Image profile path
119
     * @return string
120
     */
121 1
    public function getProfilePath()
122
    {
123 1
        return $this->profile_path;
124
    }
125
126
}
127