Payload   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getPayload() 0 14 1
1
<?php
2
3
namespace JWage\APNS;
4
5
class Payload
6
{
7
    /**
8
     * @var string
9
     */
10
    private $title;
11
12
    /**
13
     * @var string
14
     */
15
    private $body;
16
17
    /**
18
     * @var string
19
     */
20
    private $deepLink;
21
22
    /**
23
     * Construct.
24
     *
25
     * @param string $title
26
     * @param string $body
27
     * @param string $deepLink
28
     */
29
    public function __construct($title, $body, $deepLink = null)
30
    {
31
        $this->title = $title;
32
        $this->body = $body;
33
        $this->deepLink = $deepLink;
34
    }
35
36
    /**
37
     * Gets payload array structure.
38
     *
39
     * @return array $payload
40
     */
41
    public function getPayload()
42
    {
43
        return array(
44
            'aps' => array(
45
                'alert' => array(
46
                    'title' => $this->title,
47
                    'body' => $this->body,
48
                ),
49
                'url-args' => array(
50
                    $this->deepLink,
51
                ),
52
            ),
53
        );
54
    }
55
}
56