Attachment::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
4
namespace databoxtech\multisocial;
5
6
7
class Attachment
8
{
9
    public const TYPE_IMAGE = 10;
10
    public const TYPE_GIF   = 20;
11
    public const TYPE_VIDEO = 30;
12
    public const TYPE_DOC   = 40;
13
14
    /**
15
     * @var string file path of the object. Only local file paths are supported
16
     */
17
    private $path;
18
    /**
19
     * @var string caption of the attachment/ filename
20
     */
21
    private $caption;
22
    /**
23
     * @var integer type of the attachment. Should be one of TYPE_IMAGE | TYPE_GIF | TYPE_VIDEO | TYPE_DOC
24
     */
25
    private $type;
26
27
    /**
28
     * Attachment constructor.
29
     * @param string $path
30
     * @param string $caption
31
     * @param int $type
32
     */
33 18
    public function __construct(string $path, string $caption, int $type)
34
    {
35 18
        $this->path = $path;
36 18
        $this->caption = $caption;
37 18
        $this->type = $type;
38 18
    }
39
40
41
    /**
42
     * @return string
43
     */
44 3
    public function getPath(): string
45
    {
46 3
        return $this->path;
47
    }
48
49
    /**
50
     * @param string $path
51
     */
52 1
    public function setPath(string $path): void
53
    {
54 1
        $this->path = $path;
55 1
    }
56
57
    /**
58
     * @return string
59
     */
60 3
    public function getCaption(): string
61
    {
62 3
        return $this->caption;
63
    }
64
65
    /**
66
     * @param string $caption
67
     */
68 1
    public function setCaption(string $caption): void
69
    {
70 1
        $this->caption = $caption;
71 1
    }
72
73
    /**
74
     * @return int
75
     */
76 3
    public function getType(): int
77
    {
78 3
        return $this->type;
79
    }
80
81
    /**
82
     * @param int $type
83
     */
84 1
    public function setType(int $type): void
85
    {
86 1
        $this->type = $type;
87 1
    }
88
89
90
}