Completed
Push — master ( 3347ae...8ec7fe )
by Romain
9s
created

SendRequest::buildHeaders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace Kerox\Messenger\Request;
3
4
class SendRequest extends AbstractRequest
5
{
6
7
    /**
8
     * @var string
9
     */
10
    protected $recipient;
11
12
    /**
13
     * @var null|string|\Kerox\Messenger\Model\Message
14
     */
15
    protected $message;
16
17
    /**
18
     * @var null|string
19
     */
20
    protected $senderAction;
21
22
    /**
23
     * @var null|string
24
     */
25
    protected $notificationType;
26
27
    /**
28
     * Request constructor.
29
     *
30
     * @param string $pageToken
31
     * @param string $recipient
32
     * @param $message
33
     * @param $senderAction
34
     * @param $notificationType
35
     */
36
    public function __construct(string $pageToken, string $recipient, $message, $senderAction, $notificationType)
37
    {
38
        parent::__construct($pageToken);
39
40
        $this->recipient = $recipient;
41
        $this->message = $message;
42
        $this->senderAction = $senderAction;
43
        $this->notificationType = $notificationType;
44
    }
45
46
    /**
47
     * @return array
48
     */
49
    protected function buildHeaders(): array
50
    {
51
        return [
52
            'Content-Type' => 'application/json',
53
        ];
54
    }
55
56
    /**
57
     * @return array
58
     */
59
    protected function buildBody(): array
60
    {
61
        $body = [
62
            'recipient' => [
63
                'id' => $this->recipient,
64
            ],
65
            'message' => $this->message,
66
            'sender_action' => $this->senderAction,
67
            'notification_type' => $this->notificationType,
68
        ];
69
70
        return array_filter($body);
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    protected function buildQuery(): array
77
    {
78
        parent::buildQuery();
79
    }
80
}
81