Completed
Pull Request — master (#2)
by
unknown
08:22
created

Movie::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 13
loc 13
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 2
crap 1
1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5 View Code Duplication
class Movie extends Results
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    protected $overview       = null;
8
    protected $release_date   = null;
9
    protected $original_title = null;
10
    protected $title          = null;
11
12
    /**
13
     * Constructor
14
     * @param \vfalies\tmdb\Tmdb $tmdb
15
     * @param \stdClass $result
16
     * @throws \Exception
17
     */
18 13
    public function __construct(\vfalies\tmdb\Tmdb $tmdb, \stdClass $result)
19
    {
20 13
        parent::__construct($tmdb, $result);
21
22
        // Populate data
23 13
        $this->id             = $result->id;
24 13
        $this->overview       = $result->overview;
25 13
        $this->release_date   = $result->release_date;
26 13
        $this->original_title = $result->original_title;
27 13
        $this->title          = $result->title;
28 13
        $this->poster_path    = $result->poster_path;
29 13
        $this->backdrop_path  = $result->backdrop_path;
30 13
    }
31
32
    /**
33
     * Get movie ID
34
     * @return int
35
     */
36 1
    public function getId(): int
37
    {
38 1
        return (int) $this->id;
39
    }
40
41
    /**
42
     * Get movie overview
43
     * @return string
44
     */
45 1
    public function getOverview(): string
46
    {
47 1
        return $this->overview;
48
    }
49
50
    /**
51
     * Get movie release date
52
     * @return string
53
     */
54 1
    public function getReleaseDate(): string
55
    {
56 1
        return $this->release_date;
57
    }
58
59
    /**
60
     * Get movie original title
61
     * @return string
62
     */
63 1
    public function getOriginalTitle(): string
64
    {
65 1
        return $this->original_title;
66
    }
67
68
    /**
69
     * Get movie title
70
     * @return string
71
     */
72 1
    public function getTitle(): string
73
    {
74 1
        return $this->title;
75
    }
76
77
}
78