TVShow::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 2
dl 0
loc 18
ccs 13
cts 13
cp 1
crap 1
rs 9.8666
c 0
b 0
f 0
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\TVShowResultsInterface;
19
use VfacTmdb\Traits\ElementTrait;
20
use VfacTmdb\Traits\Results\ShowTrait;
21
use VfacTmdb\Interfaces\TmdbInterface;
22
23
/**
24
 * Class to manipulate a TV Show result
25
 * @package Tmdb
26
 * @author Vincent Faliès <[email protected]>
27
 * @copyright Copyright (c) 2017
28
 */
29
class TVShow extends Results implements TVShowResultsInterface
30
{
31
    /**
32
     * Image backdrop path
33
     * @var string
34
     */
35
    protected $backdrop_path = null;
36
    /**
37
     * Image poster path
38
     * @var string
39
     */
40
    protected $poster_path = null;
41
42
    use ElementTrait;
43
    use ShowTrait;
44
45
    /**
46
     * Constructor
47
     * @param TmdbInterface $tmdb
48
     * @param \stdClass $result
49
     */
50 33
    public function __construct(TmdbInterface $tmdb, \stdClass $result)
51
    {
52 33
        array_push($this->property_blacklist, 'release_date'); // For renaming first_air_date to release_date
53 33
        array_push($this->property_blacklist, 'original_title'); // For renaming original_name to original_title
54 33
        array_push($this->property_blacklist, 'title'); // For renaming name to title
55
56 33
        parent::__construct($tmdb, $result);
57
58
        // Populate data
59 33
        $this->id             = $this->data->id;
60 33
        $this->overview       = $this->data->overview;
61 33
        $this->release_date   = $this->data->first_air_date;
62 33
        $this->original_title = $this->data->original_name;
63 33
        $this->title          = $this->data->name;
64 33
        $this->poster_path    = $this->data->poster_path;
65 33
        $this->backdrop_path  = $this->data->backdrop_path;
66
67 33
        $this->setElementTrait($this->data);
68 33
    }
69
}
70