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

Company   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 62
c 0
b 0
f 0
wmc 13
lcom 1
cbo 1
ccs 27
cts 27
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDescription() 0 7 2
A getHeadQuarters() 0 7 2
A getHomePage() 0 7 2
A getId() 0 7 2
A getLogoPath() 0 7 2
A getName() 0 7 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