Passed
Push — master ( ddfb88...ea9ad4 )
by vincent
41s
created

Company::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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...
Bug introduced by
The property id 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