UriFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
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\Protocol\Http\UriFactory;
15
16
use Apple\ApnPush\Model\DeviceToken;
17
18
/**
19
 * Default URI factory
20
 */
21
class UriFactory implements UriFactoryInterface
22
{
23
    /**
24
     * Create URI for device
25
     *
26
     * @param DeviceToken $deviceToken
27
     * @param bool        $sandbox
28
     *
29
     * @return string
30
     */
31
    public function create(DeviceToken $deviceToken, bool $sandbox): string
32
    {
33
        $uri = 'https://api.push.apple.com/3/device/%s';
34
35
        if ($sandbox) {
36
            $uri = 'https://api.development.push.apple.com/3/device/%s';
37
        }
38
39
        return \sprintf($uri, $deviceToken);
40
    }
41
}
42