Test Setup Failed
Pull Request — master (#43)
by Michael
01:51
created

CollapseId   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getValue() 0 4 1
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