Passed
Pull Request — master (#59)
by vincent
22:28
created

Cast::getOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
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-2021
12
 */
13
14
namespace VfacTmdb\Results;
15
16
use VfacTmdb\Abstracts\Results;
17
use VfacTmdb\Interfaces\Results\CastResultsInterface;
18
use VfacTmdb\Interfaces\TmdbInterface;
19
20
/**
21
 * Class to manipulate a movie or tv show cast result
22
 * @package Tmdb
23
 * @author Vincent Faliès <[email protected]>
24
 * @copyright Copyright (c) 2017-2021
25
 */
26
class Cast extends Results implements CastResultsInterface
27
{
28
    /**
29
     * Character name
30
     * @var string
31
     */
32
    protected $character = null;
33
    /**
34
     * Gender
35
     * @var int
36
     */
37
    protected $gender = null;
38
    /**
39
     * Credit Id
40
     * @var string
41
     */
42
    protected $credit_id = null;
43
44
    /**
45
     * Name
46
     * @var string
47
     */
48
    protected $name = null;
49
    /**
50
     * Image profile path
51
     * @var string
52
     */
53
    protected $profile_path = null;
54
    /**
55
     * Order in cast
56
     * @var int
57
     */
58
    protected $order = null;
59
    /**
60
     * Id
61
     * @var int
62
     */
63
    protected $id = null;
64
65
    /**
66
     * Constructor
67
     * @param TmdbInterface $tmdb
68
     * @param \stdClass $result
69
     */
70
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
71
    {
72
        parent::__construct($tmdb, $result);
73
74 33
        $this->id           = $this->data->id;
75
        $this->character    = $this->data->character;
76 33
        $this->gender       = $this->data->gender;
77
        $this->credit_id    = $this->data->credit_id;
78 33
        $this->name         = $this->data->name;
79 33
        $this->profile_path = $this->data->profile_path;
80 33
        $this->order        = $this->data->order;
81 33
    }
82 33
83 33
    /**
84 33
     * Get Id
85 33
     * @return int
86 33
     */
87
    public function getId() : int
88
    {
89
        return (int) $this->id;
90
    }
91
92 9
    /**
93
     * Get credit Id
94 9
     * @return string
95
     */
96
    public function getCreditId() : string
97
    {
98
        return $this->credit_id;
99
    }
100
101 3
    /**
102
     * Get character name
103 3
     * @return string
104
     */
105
    public function getCharacter() : string
106
    {
107
        return $this->character;
108
    }
109
110 3
    /**
111
     * Get gender
112 3
     * @return int
113
     */
114
    public function getGender() : int
115
    {
116
        return $this->gender;
117
    }
118
119 3
    /**
120
     * Get name
121 3
     * @return string
122
     */
123
    public function getName() : string
124
    {
125
        return $this->name;
126
    }
127
128 3
    /**
129
     * Get profile path
130 3
     * @return string
131
     */
132
    public function getProfilePath() : string
133
    {
134
        return $this->profile_path;
135
    }
136
137 3
    /**
138
     * Get Order
139 3
     * @return int
140
     */
141
    public function getOrder() : int
142
    {
143
        return $this->order;
144
    }
145
}
146