Episode   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 32
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 3
1
<?php
2
3
namespace musa11971\TVDB;
4
5
use Carbon\Carbon;
0 ignored issues
show
Bug introduced by
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 Episode {
8
    public $id;
9
    public $imdbId;
10
    public $name;
11
    public $image;
12
    public $season;
13
    public $number;
14
    public $synopsis;
15
    public $firstAired;
16
    public $lastUpdated;
17
    public $directors;
18
    public $writers;
19
    public $guestStars;
20
    public $tvdbRating;
21
22
    public function __construct($data) {
23
        $this->id = $data->id;
24
        $this->imdbId = (strlen($data->imdbId)) ? $data->imdbId : null;
25
        $this->name = $data->episodeName;
26
27
        if($data->filename)
28
            $this->image = TVDB::IMAGE_URL_PREFIX . $data->filename;
29
        else
30
            $this->image = null;
31
32
        $this->season = $data->airedSeason;
33
        $this->number = $data->airedEpisodeNumber;
34
        $this->synopsis = $data->overview;
35
        $this->firstAired = Carbon::parse($data->firstAired);
36
        $this->lastUpdated = Carbon::createFromTimestamp($data->lastUpdated);
37
        $this->directors = $data->directors;
38
        $this->writers = $data->writers;
39
        $this->guestStars = $data->guestStars;
40
        $this->tvdbRating = [
41
            'average'   => $data->siteRating,
42
            'count'     => $data->siteRatingCount
43
        ];
44
    }
45
}