Passed
Push — master ( ddfb88...ea9ad4 )
by vincent
41s
created

src/Results/TVSeason.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5
use vfalies\tmdb\Abstracts\Results;
6
use vfalies\tmdb\Tmdb;
7
use vfalies\tmdb\Interfaces\Results\TVSeasonResultsInterface;
8
use vfalies\tmdb\Traits\ElementTrait;
9
10
class TVSeason extends Results implements TVSeasonResultsInterface
11
{
12
    use ElementTrait;
13
14
    protected $episode_count = 0;
15
    protected $season_number = 0;
16
    protected $poster_path   = null;
17
    protected $air_date  = null;
18
19
    /**
20
     * Constructor
21
     * @param \vfalies\tmdb\Tmdb $tmdb
22
     * @param \stdClass $result
23
     * @throws \Exception
24
     */
25 5
    public function __construct(Tmdb $tmdb, \stdClass $result)
26
    {
27 5
        parent::__construct($tmdb, $result);
28
29
        // Populate data
30 5
        $this->id            = $this->data->id;
0 ignored issues
show
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31 5
        $this->air_date  = $this->data->air_date;
32 5
        $this->episode_count = $this->data->episode_count;
33 5
        $this->poster_path   = $this->data->poster_path;
34 5
        $this->season_number = $this->data->season_number;
35 5
    }
36
37 1
    public function getId()
38
    {
39 1
        return $this->id;
40
    }
41
42 1
    public function getAirDate()
43
    {
44 1
        return $this->air_date;
45
    }
46
47 1
    public function getEpisodeCount()
48
    {
49 1
        return (int) $this->episode_count;
50
    }
51
52 1
    public function getSeasonNumber()
53
    {
54 1
        return (int) $this->season_number;
55
    }
56
}
57