ApnsReceiver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setToken() 0 10 3
1
<?php
2
/**
3
 * Push notification services abstraction (http://github.com/juliangut/tify)
4
 *
5
 * @link https://github.com/juliangut/tify for the canonical source repository
6
 *
7
 * @license https://github.com/juliangut/tify/blob/master/LICENSE
8
 */
9
10
namespace Jgut\Tify\Receiver;
11
12
/**
13
 * Class ApnsReceiver
14
 */
15
class ApnsReceiver extends AbstractReceiver
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @throws \InvalidArgumentException
21
     *
22
     * @return $this
23
     */
24
    public function setToken($token)
25
    {
26
        if (!ctype_xdigit($token) || strlen(trim($token)) !== 64) {
27
            throw new \InvalidArgumentException('APNS token must be a 64 hex string');
28
        }
29
30
        $this->token = trim($token);
31
32
        return $this;
33
    }
34
}
35