Completed
Push — master ( b2c31d...142309 )
by Vitaliy
01:49
created

Aps   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 198
Duplicated Lines 0 %

Coupling/Cohesion

Components 6
Dependencies 0

Importance

Changes 0
Metric Value
wmc 13
lcom 6
cbo 0
dl 0
loc 198
rs 9.0909
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A withAlert() 0 8 1
A getAlert() 0 4 1
A withCategory() 0 8 1
A getCategory() 0 4 1
A withSound() 0 8 1
A getSound() 0 4 1
A withBadge() 0 8 1
A getBadge() 0 4 1
A withContentAvailable() 0 8 1
A isContentAvailable() 0 4 1
A withThreadId() 0 8 1
A getThreadId() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the AppleApnPush package
5
 *
6
 * (c) Vitaliy Zhuk <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code
10
 */
11
12
namespace Apple\ApnPush\Model;
13
14
/**
15
 * Default APS data
16
 */
17
class Aps
18
{
19
    /**
20
     * @var Alert
21
     */
22
    private $alert;
23
24
    /**
25
     * @var int
26
     */
27
    private $badge = 0;
28
29
    /**
30
     * @var string
31
     */
32
    private $sound = '';
33
34
    /**
35
     * @var bool
36
     */
37
    private $contentAvailable = false;
38
39
    /**
40
     * @var string
41
     */
42
    private $category = '';
43
44
    /**
45
     * @var string
46
     */
47
    private $threadId = '';
48
49
    /**
50
     * Constructor.
51
     *
52
     * @param Alert $alert
53
     */
54
    public function __construct(Alert $alert)
55
    {
56
        $this->alert = $alert;
57
    }
58
59
    /**
60
     * Set alert
61
     *
62
     * @param Alert $alert
63
     *
64
     * @return Aps
65
     */
66
    public function withAlert(Alert $alert) : Aps
67
    {
68
        $cloned = clone $this;
69
70
        $cloned->alert = $alert;
71
72
        return $cloned;
73
    }
74
75
    /**
76
     * Get alert data
77
     *
78
     * @return Alert
79
     */
80
    public function getAlert() : Alert
81
    {
82
        return $this->alert;
83
    }
84
85
    /**
86
     * Set category
87
     *
88
     * @param string $category
89
     *
90
     * @return Aps
91
     */
92
    public function withCategory(string $category) : Aps
93
    {
94
        $cloned = clone $this;
95
96
        $cloned->category = $category;
97
98
        return $cloned;
99
    }
100
101
    /**
102
     * Get category
103
     *
104
     * @return string
105
     */
106
    public function getCategory() : string
107
    {
108
        return $this->category;
109
    }
110
111
    /**
112
     * Set sound
113
     *
114
     * @param string $sound
115
     *
116
     * @return Aps
117
     */
118
    public function withSound(string $sound) : Aps
119
    {
120
        $cloned = clone $this;
121
122
        $cloned->sound = $sound;
123
124
        return $cloned;
125
    }
126
127
    /**
128
     * Get sound
129
     *
130
     * @return string
131
     */
132
    public function getSound() : string
133
    {
134
        return $this->sound;
135
    }
136
137
    /**
138
     * Set badge
139
     *
140
     * @param int $badge
141
     *
142
     * @return Aps
143
     */
144
    public function withBadge(int $badge) : Aps
145
    {
146
        $cloned = clone $this;
147
148
        $cloned->badge = (int) $badge;
149
150
        return $cloned;
151
    }
152
153
    /**
154
     * Get badge
155
     *
156
     * @return int
157
     */
158
    public function getBadge() : int
159
    {
160
        return $this->badge;
161
    }
162
163
    /**
164
     * Set content available option
165
     *
166
     * @param bool $contentAvailable
167
     *
168
     * @return Aps
169
     */
170
    public function withContentAvailable(bool $contentAvailable) : Aps
171
    {
172
        $cloned = clone $this;
173
174
        $cloned->contentAvailable = $contentAvailable;
175
176
        return $cloned;
177
    }
178
179
    /**
180
     * Get content available option
181
     *
182
     * @return bool
183
     */
184
    public function isContentAvailable() : bool
185
    {
186
        return $this->contentAvailable;
187
    }
188
189
    /**
190
     * Set thread id
191
     *
192
     * @param string $threadId
193
     *
194
     * @return Aps
195
     */
196
    public function withThreadId(string $threadId) : Aps
197
    {
198
        $cloned = clone $this;
199
200
        $cloned->threadId = $threadId;
201
202
        return $cloned;
203
    }
204
205
    /**
206
     * Get thread id
207
     *
208
     * @return string
209
     */
210
    public function getThreadId() : string
211
    {
212
        return $this->threadId;
213
    }
214
}
215