Issues (9)

src/VfacTmdb/Results/TVSeason.php (1 issue)

Labels
Severity
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\TVSeasonResultsInterface;
19
use VfacTmdb\Traits\ElementTrait;
20
use VfacTmdb\Interfaces\TmdbInterface;
21
22
/**
23
 * Class to manipulate a TV Season result
24
 * @package Tmdb
25
 * @author Vincent Faliès <[email protected]>
26
 * @copyright Copyright (c) 2017
27
 */
28
class TVSeason extends Results implements TVSeasonResultsInterface
29
{
30
    use ElementTrait;
0 ignored issues
show
The trait VfacTmdb\Traits\ElementTrait requires the property $backdrop_path which is not provided by VfacTmdb\Results\TVSeason.
Loading history...
31
32
    /**
33
     * Episode count
34
     * @var int
35
     */
36
    protected $episode_count = 0;
37
    /**
38
     * Season number
39
     * @var int
40
     */
41
    protected $season_number = 0;
42
    /**
43
     * Image poster path
44
     * @var string
45
     */
46
    protected $poster_path = null;
47
    /**
48
     * Air date
49
     * @var string
50
     */
51
    protected $air_date = null;
52
    /**
53
     * Id
54
     * @var int
55
     */
56
    protected $id = null;
57
58
    /**
59
     * Constructor
60
     * @param TmdbInterface $tmdb
61
     * @param \stdClass $result
62
     * @throws \Exception
63
     */
64 18
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
65
    {
66 18
        parent::__construct($tmdb, $result);
67
68
        // Populate data
69 18
        $this->id            = $this->data->id;
70 18
        $this->air_date      = $this->data->air_date;
71 18
        $this->episode_count = $this->data->episode_count;
72 18
        $this->poster_path   = $this->data->poster_path;
73 18
        $this->season_number = $this->data->season_number;
74
75 18
        $this->setElementTrait($this->data);
76 18
    }
77
78
    /**
79
     * Id
80
     * @return int
81
     */
82 3
    public function getId() : int
83
    {
84 3
        return $this->id;
85
    }
86
87
    /**
88
     * Air date
89
     * @return string
90
     */
91 3
    public function getAirDate() : string
92
    {
93 3
        return $this->air_date;
94
    }
95
96
    /**
97
     * Episode count
98
     * @return int
99
     */
100 3
    public function getEpisodeCount() : int
101
    {
102 3
        return (int) $this->episode_count;
103
    }
104
105
    /**
106
     * Season Number
107
     * @return int
108
     */
109 6
    public function getSeasonNumber() : int
110
    {
111 6
        return (int) $this->season_number;
112
    }
113
}
114