Completed
Push — master ( 615879...2eb041 )
by Vladimir
02:48
created

VkCommunityReceivedMessage::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels\VkCommunity;
6
7
use FondBot\Contracts\Channels\ReceivedMessage;
8
use FondBot\Contracts\Channels\Message\Location;
9
use FondBot\Contracts\Channels\Message\Attachment;
10
11
class VkCommunityReceivedMessage implements ReceivedMessage
12
{
13
    private $payload;
14
15 1
    public function __construct(array $payload)
16
    {
17 1
        $this->payload = $payload;
18 1
    }
19
20
    /**
21
     * Get text.
22
     *
23
     * @return string|null
24
     */
25 1
    public function getText(): ?string
26
    {
27 1
        return $this->payload['body'] ?? null;
28
    }
29
30
    /**
31
     * Get location.
32
     *
33
     * @return Location|null
34
     */
35 1
    public function getLocation(): ?Location
36
    {
37 1
        return null;
38
    }
39
40
    /**
41
     * Determine if message has attachment.
42
     *
43
     * @return bool
44
     */
45 1
    public function hasAttachment(): bool
46
    {
47 1
        return false;
48
    }
49
50
    /**
51
     * Get attachment.
52
     *
53
     * @return Attachment|null
54
     */
55 1
    public function getAttachment(): ?Attachment
56
    {
57 1
        return null;
58
    }
59
60
    /**
61
     * Determine if message has data payload.
62
     *
63
     * @return bool
64
     */
65
    public function hasData(): bool
66
    {
67
        return false;
68
    }
69
70
    /**
71
     * Get data payload.
72
     *
73
     * @return string|null
74
     */
75
    public function getData(): ?string
76
    {
77
        return null;
78
    }
79
}
80