People::getProfilePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
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
 * @author Vincent Faliès <[email protected]>
11
 * @copyright Copyright (c) 2017
12
 */
13
14
15
namespace VfacTmdb\Results;
16
17
use VfacTmdb\Abstracts\Results;
18
use VfacTmdb\Interfaces\Results\PeopleResultsInterface;
19
use VfacTmdb\Interfaces\TmdbInterface;
20
21
/**
22
 * People class
23
 * @package Tmdb
24
 * @author Vincent Faliès <[email protected]>
25
 * @copyright Copyright (c) 2017
26
 */
27
class People extends Results implements PeopleResultsInterface
28
{
29
    /**
30
     * Adult
31
     * @var bool
32
     */
33
    protected $adult = null;
34
    /**
35
     * People known for
36
     * @var array
37
     */
38
    protected $known_for = null;
39
    /**
40
     * People name
41
     * @var string
42
     */
43
    protected $name = null;
44
    /**
45
     * Popularity
46
     * @var int
47
     */
48
    protected $popularity = null;
49
    /**
50
     * Image profile path
51
     * @var string
52
     */
53
    protected $profile_path = null;
54
    /**
55
     * Id
56
     * @var int
57
     */
58
    protected $id = null;
59
60
    /**
61
     * Constructor
62
     * @param TmdbInterface $tmdb
63
     * @param \stdClass $result
64
     * @throws \Exception
65
     */
66 24
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
67
    {
68 24
        parent::__construct($tmdb, $result);
69
70
        // Populate data
71 24
        $this->id           = $this->data->id;
72 24
        $this->adult        = $this->data->adult;
73 24
        $this->known_for    = $this->data->known_for;
74 24
        $this->name         = $this->data->name;
75 24
        $this->popularity   = $this->data->popularity;
76 24
        $this->profile_path = $this->data->profile_path;
77 24
    }
78
79
    /**
80
     * Get Id
81
     * @return int
82
     */
83 3
    public function getId() : int
84
    {
85 3
        return (int) $this->id;
86
    }
87
88
    /**
89
     * Get Adult
90
     * @return bool
91
     */
92 3
    public function getAdult() : bool
93
    {
94 3
        return $this->adult;
95
    }
96
97
    /**
98
     * People name
99
     * @return string
100
     */
101 6
    public function getName() : string
102
    {
103 6
        return $this->name;
104
    }
105
106
    /**
107
     * People Popularity
108
     * @return float
109
     */
110 3
    public function getPopularity() : float
111
    {
112 3
        return $this->popularity;
113
    }
114
115
    /**
116
     * Image profile path
117
     * @return string
118
     */
119 3
    public function getProfilePath() : string
120
    {
121 3
        return $this->profile_path;
122
    }
123
}
124