Completed
Pull Request — master (#30)
by vincent
03:53
created

People::getAdult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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 string
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 6 View Code Duplication
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68 6
        parent::__construct($tmdb, $result);
69
70
        // Populate data
71 6
        $this->id           = $this->data->id;
72 6
        $this->adult        = $this->data->adult;
73 6
        $this->known_for    = $this->data->known_for;
74 6
        $this->name         = $this->data->name;
75 6
        $this->popularity   = $this->data->popularity;
76 6
        $this->profile_path = $this->data->profile_path;
77 6
    }
78
79
    /**
80
     * Get Id
81
     * @return int
82
     */
83 1
    public function getId() : int
84
    {
85 1
        return (int) $this->id;
86
    }
87
88
    /**
89
     * Get Adult
90
     * @return bool
91
     */
92 1
    public function getAdult() : bool
93
    {
94 1
        return $this->adult;
95
    }
96
97
    /**
98
     * People name
99
     * @return string
100
     */
101 1
    public function getName() : string
102
    {
103 1
        return $this->name;
104
    }
105
106
    /**
107
     * People Popularity
108
     * @return float
109
     */
110 1
    public function getPopularity() : float
111
    {
112 1
        return $this->popularity;
113
    }
114
115
    /**
116
     * Image profile path
117
     * @return string
118
     */
119 1
    public function getProfilePath() : string
120
    {
121 1
        return $this->profile_path;
122
    }
123
}
124