Completed
Branch develop (a0a623)
by Romain
02:33
created

Attachment::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Kerox\Messenger\Message;
3
4
use Kerox\Messenger\ValidatorTrait;
5
6
class Attachment implements \JsonSerializable
7
{
8
9
    use ValidatorTrait;
10
11
    const TYPE_IMAGE = 'image';
12
    const TYPE_AUDIO = 'audio';
13
    const TYPE_VIDEO = 'video';
14
    const TYPE_FILE = 'file';
15
    const TYPE_TEMPLATE = 'template';
16
17
    /**
18
     * @var string
19
     */
20
    protected $type;
21
22
    /**
23
     * Attachment constructor.
24
     *
25
     * @param string $type
26
     */
27
    public function __construct(string $type)
28
    {
29
        $this->type = $type;
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    public function jsonSerialize(): array
36
    {
37
        $json = [
38
            'type' => $this->type,
39
        ];
40
41
        return $json;
42
    }
43
}