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

UriFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 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