Completed
Pull Request — master (#23)
by vincent
04:12 queued 02:01
created

Company   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getId() 0 4 1
A getLogoPath() 0 4 1
A getName() 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\CompanyResultsInterface;
8
9
class Company extends Results implements CompanyResultsInterface
10
{
11
12
    protected $name      = null;
13
    protected $logo_path = null;
14
15
    /**
16
     * Constructor
17
     * @param \vfalies\tmdb\Tmdb $tmdb
18
     * @param \stdClass $result
19
     */
20 4
    public function __construct(Tmdb $tmdb, \stdClass $result)
21
    {
22 4
        parent::__construct($tmdb, $result);
23
24
        // Populate data
25 4
        $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...
26 4
        $this->name      = $this->data->name;
27 4
        $this->logo_path = $this->data->logo_path;
28 4
    }
29
30 1
    public function getId()
31
    {
32 1
        return $this->id;
33
    }
34
35 1
    public function getLogoPath()
36
    {
37 1
        return $this->logo_path;
38
    }
39
40 1
    public function getName()
41
    {
42 1
        return $this->name;
43
    }
44
45
}
46