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

TVShow   A

Complexity

Total Complexity 6

Size/Duplication

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