Completed
Push — master ( 58620c...f23d9f )
by Vitaliy
02:20
created

UriFactory   A

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
/*
4
 * This file is part of the AppleApnPush package
5
 *
6
 * (c) Vitaliy Zhuk <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code
10
 */
11
12
namespace Apple\ApnPush\Protocol\Http\UriFactory;
13
14
use Apple\ApnPush\Model\DeviceToken;
15
16
/**
17
 * Default URI factory
18
 */
19
class UriFactory implements UriFactoryInterface
20
{
21
    /**
22
     * Create URI for device
23
     *
24
     * @param DeviceToken $deviceToken
25
     * @param bool        $sandbox
26
     *
27
     * @return string
28
     */
29
    public function create(DeviceToken $deviceToken, bool $sandbox) : string
30
    {
31
        if ($sandbox) {
32
            $uri = 'https://api.development.push.apple.com/3/device/%s';
33
        } else {
34
            $uri = 'https://api.push.apple.com/3/device/%s';
35
        }
36
37
        return sprintf($uri, $deviceToken);
38
    }
39
}
40