Agency::setCountryId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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