Movie::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

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