Completed
Push — master ( 72cf95...b4fc03 )
by Artem
08:38
created

getNumberOfSequentialSentTokens()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 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\Target;
14
15
/**
16
 * SingleRecipientTarget.
17
 *
18
 * @author Artem Henvald <[email protected]>
19
 */
20
class SingleRecipientTarget implements TargetInterface, TokenTargetInterface
21
{
22
    /** @var string */
23
    private $registrationToken = '';
24
25
    /**
26
     * @param string $registrationToken
27
     *
28
     * @return $this
29
     */
30
    public function setRegistrationToken(string $registrationToken): self
31
    {
32
        $this->registrationToken = $registrationToken;
33
34
        return $this;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getRegistrationToken(): string
41
    {
42
        return $this->registrationToken;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getSequentialSentTokens(): array
49
    {
50
        return (array) $this->getRegistrationToken();
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getNumberOfSequentialSentTokens(): int
57
    {
58
        return !empty($this->getRegistrationToken()) ? 1 : 0;
59
    }
60
}
61