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

Movie   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 73
loc 73
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 13 13 1
A getId() 4 4 1
A getOverview() 4 4 1
A getReleaseDate() 4 4 1
A getOriginalTitle() 4 4 1
A getTitle() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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