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

Cast::getOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
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
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
25
 */
26 View Code Duplication
class Cast extends Results implements CastResultsInterface
0 ignored issues
show
Duplication introduced by
This class 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...
27
{
28
    /**
29
     * Character name
30
     * @var string
31
     */
32
    protected $character = null;
33
    /**
34
     * Gender
35
     * @var string
36
     */
37
    protected $gender = null;
38
    /**
39
     * Credit Id
40
     * @var string
41
     */
42
    protected $credit_id = null;
43
    /**
44
     * Cast Id
45
     * @var int
46
     */
47
    protected $cast_id = null;
48
    /**
49
     * Name
50
     * @var string
51
     */
52
    protected $name = null;
53
    /**
54
     * Image profile path
55
     * @var string
56
     */
57
    protected $profile_path = null;
58
    /**
59
     * Order in cast
60
     * @var int
61
     */
62
    protected $order = null;
63
    /**
64
     * Id
65
     * @var int
66
     */
67
    protected $id = null;
68
69
    /**
70
     * Constructor
71
     * @param TmdbInterface $tmdb
72
     * @param \stdClass $result
73
     */
74 11
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
75
    {
76 11
        parent::__construct($tmdb, $result);
77
78 11
        $this->id           = $this->data->id;
79 11
        $this->character    = $this->data->character;
80 11
        $this->gender       = $this->data->gender;
81 11
        $this->credit_id    = $this->data->credit_id;
82 11
        $this->cast_id      = $this->data->cast_id;
83 11
        $this->name         = $this->data->name;
84 11
        $this->profile_path = $this->data->profile_path;
85 11
        $this->order        = $this->data->order;
86 11
    }
87
88
    /**
89
     * Get Id
90
     * @return int
91
     */
92 3
    public function getId() : int
93
    {
94 3
        return (int) $this->id;
95
    }
96
97
    /**
98
     * Get credit Id
99
     * @return string
100
     */
101 1
    public function getCreditId() : string
102
    {
103 1
        return $this->credit_id;
104
    }
105
106
    /**
107
     * Get character name
108
     * @return string
109
     */
110 1
    public function getCharacter() : string
111
    {
112 1
        return $this->character;
113
    }
114
115
    /**
116
     * Get gender
117
     * @return int
118
     */
119 1
    public function getGender() : int
120
    {
121 1
        return $this->gender;
122
    }
123
124
    /**
125
     * Get Cast Id
126
     * @return int
127
     */
128 1
    public function getCastId() : int
129
    {
130 1
        return $this->cast_id;
131
    }
132
133
    /**
134
     * Get name
135
     * @return string
136
     */
137 1
    public function getName() : string
138
    {
139 1
        return $this->name;
140
    }
141
142
    /**
143
     * Get profile path
144
     * @return string
145
     */
146 1
    public function getProfilePath() : string
147
    {
148 1
        return $this->profile_path;
149
    }
150
151
    /**
152
     * Get Order
153
     * @return int
154
     */
155 1
    public function getOrder() : int
156
    {
157 1
        return $this->order;
158
    }
159
}
160