Sender   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 45
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 6 1
A createPayload() 0 4 1
1
<?php
2
3
namespace JWage\APNS;
4
5
class Sender
6
{
7
    /**
8
     * @var \JWage\APNS\Client
9
     */
10
    private $client;
11
12
    /**
13
     * Construct.
14
     *
15
     * @param \JWage\APNS\Client $client
16
     */
17
    public function __construct(Client $client)
18
    {
19
        $this->client = $client;
20
    }
21
22
    /**
23
     * Sends a safari website push notification to the given deviceToken.
24
     *
25
     * @param string $deviceToken
26
     * @param string $title 
27
     * @param string $body
28
     * @param string $deepLink
29
     */
30
    public function send($deviceToken, $title, $body, $deepLink = null)
31
    {
32
        return $this->client->sendPayload(
33
            $deviceToken, $this->createPayload($title, $body, $deepLink)
34
        );
35
    }
36
37
    /**
38
     * Creates a Payload instance.
39
     *
40
     * @param string $title
41
     * @param string $body
42
     * @param string $deepLink
43
     * @return \JWage\APNS\Payload
44
     */
45
    private function createPayload($title, $body, $deepLink = null)
46
    {
47
        return new Payload($title, $body, $deepLink);
48
    }
49
}
50