Issues (9)

src/Series.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace musa11971\TVDB;
4
5
use Carbon\Carbon;
0 ignored issues
show
The type Carbon\Carbon was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class Series {
8
    public $id;
9
    public $imdbId;
10
    public $zap2itId;
11
    public $title;
12
    public $slug;
13
    public $alternativeTitles;
14
    public $banner;
15
    public $bannerURL;
16
    public $status;
17
    public $firstAired;
18
    public $network;
19
    public $runtime;
20
    public $genres;
21
    public $synopsis;
22
    public $lastUpdated;
23
    public $airs;
24
    public $watchRating;
25
    public $tvdbRating;
26
    public $added;
27
    public $addedBy;
28
29
    public function __construct($data) {
30
        $this->id = $data->id;
31
        $this->imdbId = @$data->imdbId ?: null;
32
        $this->zap2itId = @$data->zap2itId ?: null;
33
        $this->title = @$data->seriesName ?: null;
34
        $this->slug = @$data->slug ?: null;
35
        $this->alternativeTitles = @$data->aliases ?: null;
36
        $this->banner = @$data->banner ?: null;
37
        $this->bannerURL = (isset($data->banner)) ? TVDB::IMAGE_URL_PREFIX . $data->banner : null;
38
        $this->status = @$data->status ?: null;
39
        $this->firstAired = (isset($data->firstAired)) ? Carbon::parse($data->firstAired) : null;
40
        $this->network = [
41
            'id'    => @$data->networkId ?: null,
42
            'name'  => @$data->network ?: null
43
        ];
44
        $this->runtime = (isset($data->runtime) && strlen($data->runtime) && is_numeric($data->runtime)) ? (int) $data->runtime : null;
45
        $this->genres = @$data->genre ?: null;
46
        $this->synopsis = @$data->overview ?: null;
47
        $this->lastUpdated = (isset($data->lastUpdated)) ? Carbon::createFromTimestamp($data->lastUpdated) : null;
48
        $this->airs = [
49
            'dayOfWeek' => @$data->airsDayOfWeek ?: null,
50
            'time'      => @$data->airsTime ?: null
51
        ];
52
        $this->watchRating = (strlen($data->rating)) ? $data->rating : null;
53
        $this->tvdbRating = [
54
            'average'   => @$data->siteRating ?: null,
55
            'count'     => @$data->siteRatingCount ?: null
56
        ];
57
        $this->added = @$data->added ?: null;
58
        $this->addedBy = @$data->addedBy ?: null;
59
    }
60
61
    /**
62
     * Retrieve the series' actor details
63
     *
64
     * @return array
65
     * @throws Exceptions\TVDBUnauthorizedException
66
     * @throws Exceptions\TVDBNotFoundException
67
     */
68
    public function getActors() {
69
        return TVDB::getSeriesActors($this->id);
70
    }
71
72
    /**
73
     * Retrieve the series' episode details
74
     *
75
     * @param int $page
76
     * @return EpisodeCollection
77
     * @throws Exceptions\TVDBNotFoundException
78
     * @throws Exceptions\TVDBUnauthorizedException
79
     */
80
    public function getEpisodes($page = 1) {
81
        return TVDB::getSeriesEpisodes($this->id, $page);
82
    }
83
84
    /**
85
     * Retrieve the series' images
86
     *
87
     * @param string $type
88
     * @return array
89
     * @throws Exceptions\TVDBNotFoundException
90
     * @throws Exceptions\TVDBUnauthorizedException
91
     */
92
    public function getImages($type) {
93
        return TVDB::getSeriesImages($this->id, $type);
94
    }
95
}