Completed
Push — master ( da1bfa...91a0f5 )
by Giacomo "Mr. Wolf"
01:46
created

BeesWaxSegment::setAdvertiserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Audiens\BeesWax\Segment;
4
5
class BeesWaxSegment
6
{
7
    /** @var string|null */
8
    protected $id;
9
10
    /** @var string|null */
11
    protected $alternativeId;
12
13
    /** @var int|null */
14
    protected $advertiserId;
15
16
    /**
17
     * Max 191 characters
18
     * @var string
19
     */
20
    protected $name;
21
22
    /** @var string|null */
23
    protected $description;
24
25
    /** @var float */
26
    protected $cpmCost;
27
28
    /**
29
     * Max 90
30
     * @var int
31
     */
32
    protected $ttlDays;
33
34
    /**
35
     * Should reporting include this segment when it is used as a negative target ("NOT")
36
     * @var bool
37
     */
38
    protected $aggregateExcludes;
39
40
    /**
41
     * BeesWaxSegment constructor.
42
     *
43
     * @param string   $name
44
     * @param string   $description
45
     * @param string   $alternativeId
46
     * @param int|null $advertiserId
47
     * @param float    $cpmCost
48
     * @param int      $ttlDays
49
     * @param bool     $aggregateExcludes
50
     */
51
    public function __construct(
52
        string $name,
53
        ?string $description = null,
54
        ?string $alternativeId = null,
55
        ?int $advertiserId = null,
56
        float $cpmCost = 0,
57
        int $ttlDays = 30,
58
        bool $aggregateExcludes = false
59
    ) {
60
        $this->alternativeId = $alternativeId;
61
        $this->advertiserId = $advertiserId;
62
        $this->name = $name;
63
        $this->description = $description;
64
        $this->cpmCost = $cpmCost;
65
        $this->ttlDays = $ttlDays;
66
        $this->aggregateExcludes = $aggregateExcludes;
67
    }
68
69
    public function setId(string $id): BeesWaxSegment
70
    {
71
        $this->id = $id;
72
73
        return $this;
74
    }
75
76
    public function getId(): ?string
77
    {
78
        return $this->id;
79
    }
80
81
    public function getAlternativeId(): ?string
82
    {
83
        return $this->alternativeId;
84
    }
85
86
    public function getAdvertiserId(): ?int
87
    {
88
        return $this->advertiserId;
89
    }
90
91
    public function getName(): string
92
    {
93
        return $this->name;
94
    }
95
96
    public function getDescription(): ?string
97
    {
98
        return $this->description;
99
    }
100
101
    public function getCpmCost(): float
102
    {
103
        return $this->cpmCost;
104
    }
105
106
    public function getTtlDays(): int
107
    {
108
        return $this->ttlDays;
109
    }
110
111
    public function isAggregateExcludes(): bool
112
    {
113
        return $this->aggregateExcludes;
114
    }
115
116
    public function setAlternativeId(?string $alternativeId): void
117
    {
118
        $this->alternativeId = $alternativeId;
119
    }
120
121
    public function setAdvertiserId(?int $advertiserId): void
122
    {
123
        $this->advertiserId = $advertiserId;
124
    }
125
126
    public function setName(string $name): void
127
    {
128
        $this->name = $name;
129
    }
130
131
    public function setDescription(?string $description): void
132
    {
133
        $this->description = $description;
134
    }
135
136
    public function setCpmCost(float $cpmCost): void
137
    {
138
        $this->cpmCost = $cpmCost;
139
    }
140
141
    public function setAggregateExcludes(bool $aggregateExcludes): void
142
    {
143
        $this->aggregateExcludes = $aggregateExcludes;
144
    }
145
146
    public function equals(BeesWaxSegment $segment): bool
147
    {
148
        foreach (get_object_vars($this) as $key => $value) {
149
            if ($segment->$key !== $this->$key) {
150
                return false;
151
            }
152
        }
153
154
        return true;
155
    }
156
}
157