Passed
Push — master ( 1077fc...b3c432 )
by vincent
49s
created

People   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 63
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getId() 0 4 1
A getAdult() 0 4 1
A getKnownFor() 0 4 1
A getName() 0 4 1
A getPopularity() 0 4 1
A getProfilePath() 0 4 1
1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5
use vfalies\tmdb\Abstracts\Results;
6
use vfalies\tmdb\Tmdb;
7
use vfalies\tmdb\Interfaces\Results\PeopleResultsInterface;
8
use vfalies\tmdb\Exceptions\NotYetImplementedException;
9
10
class People extends Results implements PeopleResultsInterface
11
{
12
13
    protected $adult        = null;
14
    protected $known_for    = null;
15
    protected $name         = null;
16
    protected $popularity   = null;
17
    protected $profile_path = null;
18
19
    /**
20
     * Constructor
21
     * @param \vfalies\tmdb\Tmdb $tmdb
22
     * @param \stdClass $result
23
     * @throws \Exception
24
     */
25 6
    public function __construct(Tmdb $tmdb, \stdClass $result)
26
    {
27 6
        parent::__construct($tmdb, $result);
28
29
        // Populate data
30 6
        $this->id           = $this->data->id;
0 ignored issues
show
Bug introduced by
The property data does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31 6
        $this->adult        = $this->data->adult;
32 6
        $this->known_for    = $this->data->known_for;
33 6
        $this->name         = $this->data->name;
34 6
        $this->popularity   = $this->data->popularity;
35 6
        $this->profile_path = $this->data->profile_path;
36 6
    }
37
38 1
    public function getId()
39
    {
40 1
        return (int) $this->id;
41
    }
42
43 1
    public function getAdult()
44
    {
45 1
        return $this->adult;
46
    }
47
48
    /**
49
     * @codeCoverageIgnore
50
     * @throws NotYetImplementedException
51
     */
52
    public function getKnownFor()
53
    {
54
        throw new NotYetImplementedException;
55
    }
56
57 1
    public function getName()
58
    {
59 1
        return $this->name;
60
    }
61
62 1
    public function getPopularity()
63
    {
64 1
        return $this->popularity;
65
    }
66
67 1
    public function getProfilePath()
68
    {
69 1
        return $this->profile_path;
70
    }
71
72
}
73