Completed
Push — master ( 0d4684...fff311 )
by Chris
01:24
created

ApnsConfig::getFcmOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace NotificationChannels\Fcm\Resources;
4
5
class ApnsConfig implements FcmResource
6
{
7
    /**
8
     * @var array|null
9
     */
10
    protected $headers;
11
12
    /**
13
     * @var array|null
14
     */
15
    protected $payload;
16
17
    /**
18
     * @var ApnsFcmOptions
19
     */
20
    protected $fcmOptions;
21
22
    /**
23
     * @return static
24
     */
25
    public static function create(): self
26
    {
27
        return new self;
28
    }
29
30
    /**
31
     * @return array|null
32
     */
33
    public function getHeaders(): ?array
34
    {
35
        return $this->headers;
36
    }
37
38
    /**
39
     * @param array|null $headers
40
     * @return ApnsConfig
41
     */
42
    public function setHeaders(?array $headers): self
43
    {
44
        $this->headers = $headers;
45
46
        return $this;
47
    }
48
49
    /**
50
     * @return array|null
51
     */
52
    public function getPayload(): ?array
53
    {
54
        return $this->payload;
55
    }
56
57
    /**
58
     * @param array|null $payload
59
     * @return ApnsConfig
60
     */
61
    public function setPayload(?array $payload): self
62
    {
63
        $this->payload = $payload;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return ApnsFcmOptions
70
     */
71
    public function getFcmOptions(): ApnsFcmOptions
72
    {
73
        return $this->fcmOptions;
74
    }
75
76
    /**
77
     * @param ApnsFcmOptions $fcmOptions
78
     * @return ApnsConfig
79
     */
80
    public function setFcmOptions(ApnsFcmOptions $fcmOptions): self
81
    {
82
        $this->fcmOptions = $fcmOptions;
83
84
        return $this;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function toArray(): array
91
    {
92
        return [
93
            'headers' => $this->getHeaders(),
94
            'payload' => $this->getPayload(),
95
            'fcm_options' => ! is_null($this->getFcmOptions()) ? $this->getFcmOptions()->toArray() : null,
96
        ];
97
    }
98
}
99