Passed
Push — master ( 89f3f2...2d8591 )
by vincent
39s
created

Company::getHomePage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace vfalies\tmdb\Items;
4
5
use vfalies\tmdb\Abstracts\Item;
6
use vfalies\tmdb\Interfaces\Items\CompanyInterface;
7
use vfalies\tmdb\Tmdb;
8
9
class Company extends Item implements CompanyInterface
10
{
11
    /**
12
     * Constructor
13
     * @param \vfalies\tmdb\Tmdb $tmdb
14
     * @param int $company_id
15
     * @param array $options
16
     */
17 14
    public function __construct(Tmdb $tmdb, $company_id, array $options = array())
18
    {
19 14
        parent::__construct($tmdb, $company_id, $options, 'company');
20 13
    }
21
22 2
    public function getDescription()
23
    {
24 2
        if (isset($this->data->description)) {
25 1
            return $this->data->description;
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
        }
27 1
        return '';
28
    }
29
30 2
    public function getHeadQuarters()
31
    {
32 2
        if (isset($this->data->headquarters)) {
33 1
            return $this->data->headquarters;
34
        }
35 1
        return '';
36
    }
37
38 2
    public function getHomePage()
39
    {
40 2
        if (isset($this->data->homepage)) {
41 1
            return $this->data->homepage;
42
        }
43 1
        return '';
44
    }
45
46 3
    public function getId()
47
    {
48 3
        if (isset($this->data->id)) {
49 2
            return $this->data->id;
50
        }
51 1
        return 0;
52
    }
53
54 2
    public function getLogoPath()
55
    {
56 2
        if (isset($this->data->logo_path)) {
57 1
            return $this->data->logo_path;
58
        }
59 1
        return '';
60
    }
61
62 2
    public function getName()
63
    {
64 2
        if (isset($this->data->name)) {
65 1
            return $this->data->name;
66
        }
67 1
        return '';
68
    }
69
70
}
71