Company   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 53
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getId() 0 4 1
A getName() 0 4 1
A getParentId() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Yproximite\Api\Model\Company;
5
6
use Yproximite\Api\Model\ModelInterface;
7
8
/**
9
 * Class Company
10
 */
11
class Company implements ModelInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    private $id;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var int|null
25
     */
26
    private $parentId;
27
28
    /**
29
     * Company constructor.
30
     *
31
     * @param array $data
32
     */
33
    public function __construct(array $data)
34
    {
35
        $this->id       = (int) $data['id'];
36
        $this->name     = (string) $data['companyName'];
37
        $this->parentId = !empty($data['parent']) ? (int) $data['parent'] : null;
38
    }
39
40
    /**
41
     * @return int
42
     */
43
    public function getId(): int
44
    {
45
        return $this->id;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getName(): string
52
    {
53
        return $this->name;
54
    }
55
56
    /**
57
     * @return int|null
58
     */
59
    public function getParentId()
60
    {
61
        return $this->parentId;
62
    }
63
}
64