Agency   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 11
eloc 21
c 2
b 0
f 0
dl 0
loc 73
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountryId() 0 3 1
A getName() 0 3 1
A getId() 0 3 1
A isActive() 0 3 1
A setActive() 0 3 1
A setCountryId() 0 3 1
A setId() 0 3 1
A setName() 0 3 1
A jsonSerialize() 0 19 3
1
<?php declare(strict_types=1);
2
3
namespace Audiens\AdForm\Entity;
4
5
use JsonSerializable;
6
use stdClass;
7
8
/**
9
 * Class Agency
10
 */
11
class Agency implements JsonSerializable
12
{
13
    /** @var string|null */
14
    protected $id;
15
16
    /** @var string|null */
17
    protected $name;
18
19
    /** @var int|null */
20
    protected $countryId;
21
22
    /** @var bool */
23
    protected $active;
24
25
    public function getId(): ?string
26
    {
27
        return $this->id;
28
    }
29
30
    public function setId(string $id): void
31
    {
32
        $this->id = $id;
33
    }
34
35
    public function getName(): ?string
36
    {
37
        return $this->name;
38
    }
39
40
    public function setName(string $name): void
41
    {
42
        $this->name = $name;
43
    }
44
45
    public function getCountryId(): ?int
46
    {
47
        return $this->countryId;
48
    }
49
50
    public function setCountryId(int $countryId): void
51
    {
52
        $this->countryId = $countryId;
53
    }
54
55
    public function isActive(): ?bool
56
    {
57
        return $this->active;
58
    }
59
60
    public function setActive(bool $active): void
61
    {
62
        $this->active = $active;
63
    }
64
65
    public function jsonSerialize()
66
    {
67
        $json = new stdClass();
68
69
        // might not be set for a new Agency
70
        if ($this->id !== null) {
71
            $json->id = $this->id;
72
        }
73
74
        $json->name = $this->name;
75
76
        // might not be set at all
77
        if ($this->countryId !== null) {
78
            $json->countryId = $this->countryId;
79
        }
80
81
        $json->active = $this->active;
82
83
        return $json;
84
    }
85
86
87
}
88