| Total Complexity | 7 |
| Total Lines | 80 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param string $caption |
||
| 67 | */ |
||
| 68 | 1 | public function setCaption(string $caption): void |
|
| 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 |
|
| 87 | 1 | } |
|
| 88 | |||
| 89 | |||
| 90 | } |