Company::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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