Passed
Push — feature/40-add-apns-collapse-i... ( d6d72b )
by Vitaliy
02:07
created

CollapseId::getValue()   A

Complexity

Conditions 1
Paths 1

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 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the AppleApnPush package
7
 *
8
 * (c) Vitaliy Zhuk <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace Apple\ApnPush\Model;
15
16
/**
17
 * The value object for store the apns-collapse-id
18
 */
19
class CollapseId
20
{
21
    /**
22
     * @var string
23
     */
24
    private $value;
25
26
    /**
27
     * Constructor.
28
     *
29
     * @param string $value
30
     *
31
     * @throws \InvalidArgumentException
32
     */
33
    public function __construct(string $value)
34
    {
35
        if (strlen($value) > 64) {
36
            throw new \InvalidArgumentException('The apns-collapse-id cannot be larger than 64 bytes.');
37
        }
38
39
        $this->value = $value;
40
    }
41
42
    /**
43
     * Get the value of collapse id
44
     *
45
     * @return string
46
     */
47
    public function getValue(): string
48
    {
49
        return $this->value;
50
    }
51
}
52