Completed
Push — master ( 611a4d...0d4705 )
by Artem
11:18 queued 04:23
created

Options   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 169
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 14
lcom 0
cbo 0
dl 0
loc 169
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the FirebaseCloudMessagingBundle.
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\FirebaseCloudMessagingBundle\Message\Part\Options;
14
15
/**
16
 * Class Options.
17
 *
18
 * Set of options that can be used to change default behaviour of FCM notification.
19
 *
20
 * @author Artem Henvald <[email protected]>
21
 */
22
final class Options implements OptionsInterface
23
{
24
    /**
25
     * Default `time_to_live` option value is 4 weeks (it is also the maximum TTL allowed for FCM).
26
     * In seconds it is 60 seconds * 60 minutes * 24 hours * 28 days = 2419200 seconds.
27
     */
28
    public const DEFAULT_TTL_IN_SECONDS = 2419200;
29
30
    private string $collapseKey = '';
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
31
32
    private string $priority = Priority::NORMAL;
33
34
    private bool $contentAvailable = false;
35
36
    private bool $mutableContent = false;
37
38
    private int $timeToLive = self::DEFAULT_TTL_IN_SECONDS;
39
40
    private string $restrictedPackageName = '';
41
42
    private bool $dryRun = false;
43
44
    /**
45
     * @param string $collapseKey
46
     *
47
     * @return $this
48
     */
49
    public function setCollapseKey(string $collapseKey): self
50
    {
51
        $this->collapseKey = $collapseKey;
52
53
        return $this;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getCollapseKey(): string
60
    {
61
        return $this->collapseKey;
62
    }
63
64
    /**
65
     * @param string $priority
66
     *
67
     * @return $this
68
     */
69
    public function setPriority(string $priority): self
70
    {
71
        $this->priority = $priority;
72
73
        return $this;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function getPriority(): string
80
    {
81
        return $this->priority;
82
    }
83
84
    /**
85
     * @param bool $contentAvailable
86
     *
87
     * @return $this
88
     */
89
    public function setContentAvailable(bool $contentAvailable): self
90
    {
91
        $this->contentAvailable = $contentAvailable;
92
93
        return $this;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function isContentAvailable(): bool
100
    {
101
        return $this->contentAvailable;
102
    }
103
104
    /**
105
     * @param bool $mutableContent
106
     *
107
     * @return $this
108
     */
109
    public function setMutableContent(bool $mutableContent): self
110
    {
111
        $this->mutableContent = $mutableContent;
112
113
        return $this;
114
    }
115
116
    /**
117
     * {@inheritdoc}
118
     */
119
    public function isMutableContent(): bool
120
    {
121
        return $this->mutableContent;
122
    }
123
124
    /**
125
     * @param int $timeToLive
126
     *
127
     * @return $this
128
     */
129
    public function setTimeToLive(int $timeToLive): self
130
    {
131
        $this->timeToLive = $timeToLive;
132
133
        return $this;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getTimeToLive(): int
140
    {
141
        return $this->timeToLive;
142
    }
143
144
    /**
145
     * @param string $restrictedPackageName
146
     *
147
     * @return $this
148
     */
149
    public function setRestrictedPackageName(string $restrictedPackageName): self
150
    {
151
        $this->restrictedPackageName = $restrictedPackageName;
152
153
        return $this;
154
    }
155
156
    /**
157
     * {@inheritdoc}
158
     */
159
    public function getRestrictedPackageName(): string
160
    {
161
        return $this->restrictedPackageName;
162
    }
163
164
    /**
165
     * @param bool $dryRun
166
     *
167
     * @return $this
168
     */
169
    public function setDryRun(bool $dryRun): self
170
    {
171
        $this->dryRun = $dryRun;
172
173
        return $this;
174
    }
175
176
    /**
177
     * {@inheritdoc}
178
     */
179
    public function isDryRun(): bool
180
    {
181
        return $this->dryRun;
182
    }
183
}
184