Passed
Push — master ( ce30fc...116151 )
by vincent
07:51 queued 10s
created

AlternativeName::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 10
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-2020
12
 */
13
14
15
namespace VfacTmdb\Results;
16
17
use VfacTmdb\Abstracts\Results;
18
use VfacTmdb\Interfaces\TmdbInterface;
19
20
/**
21
 * Class to manipulate a name result
22
 * @package Tmdb
23
 * @author Steve Richter <[email protected]>
24
 * @copyright Copyright (c) 2017-2020
25
 */
26
class AlternativeName extends Results
27
{
28
    /**
29
     * Id
30
     * @var int
31
     */
32
    protected $id;
33
    /**
34
     * Name
35
     * @var string
36
     */
37
    protected $name;
38
    /**
39
     * Type
40
     * @var string
41
     */
42
    protected $type;
43
44
    /**
45
     * Constructor
46
     * @param TmdbInterface $tmdb
47
     * @param int $id
48
     * @param \stdClass $result
49
     */
50 15
    public function __construct(TmdbInterface $tmdb, int $id, \stdClass $result)
51
    {
52 15
        $result->id = $id;
53 15
        parent::__construct($tmdb, $result);
54
55 12
        $this->id           = (int) $id;
56 12
        $this->name         = $result->name;
57 12
        $this->type         = $result->type;
58 12
    }
59
60
    /**
61
     * Id
62
     * @return int
63
     */
64 3
    public function getId() : int
65
    {
66 3
        return $this->id;
67
    }
68
69
    /**
70
     * Name
71
     * @return string
72
     */
73 3
    public function getName() : string
74
    {
75 3
        return $this->name;
76
    }
77
78
    /**
79
     * Type
80
     * @return string
81
     */
82 3
    public function getType() : string
83
    {
84 3
        return $this->type;
85
    }
86
}
87