1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace kalanis\EmailApi\Basics; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use kalanis\EmailApi\Interfaces\IContentAttachment; |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Attachment |
11
|
|
|
* @package kalanis\EmaiApi\Basics |
12
|
|
|
*/ |
13
|
|
|
class Attachment implements IContentAttachment |
14
|
|
|
{ |
15
|
|
|
public string $name = ''; |
16
|
|
|
public string $path = ''; |
17
|
|
|
public string $content = ''; |
18
|
|
|
public string $mime = ''; |
19
|
|
|
public string $encoding = ''; |
20
|
|
|
public int $type = self::TYPE_INLINE; |
21
|
|
|
|
22
|
5 |
|
public function setData(string $name, string $path = '', string $content = '', string $mime = '', string $encoding = '', int $type = self::TYPE_INLINE): self |
23
|
|
|
{ |
24
|
5 |
|
$this->name = $name; |
25
|
5 |
|
$this->path = $path; |
26
|
5 |
|
$this->mime = $mime; |
27
|
5 |
|
$this->content = $content; |
28
|
5 |
|
$this->encoding = $encoding; |
29
|
5 |
|
$this->type = $type; |
30
|
5 |
|
return $this; |
31
|
|
|
} |
32
|
|
|
|
33
|
1 |
|
public function sanitize(): self |
34
|
|
|
{ |
35
|
1 |
|
$this->name = strval($this->name); |
36
|
1 |
|
$this->path = strval($this->path); |
37
|
1 |
|
$this->mime = strval($this->mime); |
38
|
1 |
|
$this->content = strval($this->content); |
39
|
1 |
|
$this->encoding = strval($this->encoding); |
40
|
1 |
|
$this->type = intval($this->type); |
41
|
1 |
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
1 |
|
public function getFileName(): string |
45
|
|
|
{ |
46
|
1 |
|
return strval($this->name); |
47
|
|
|
} |
48
|
|
|
|
49
|
1 |
|
public function getFileContent(): string |
50
|
|
|
{ |
51
|
1 |
|
return strval($this->content); |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
public function getLocalPath(): string |
55
|
|
|
{ |
56
|
1 |
|
return strval($this->path); |
57
|
|
|
} |
58
|
|
|
|
59
|
1 |
|
public function getFileMime(): string |
60
|
|
|
{ |
61
|
1 |
|
return strval($this->mime); |
62
|
|
|
} |
63
|
|
|
|
64
|
1 |
|
public function getEncoding(): string |
65
|
|
|
{ |
66
|
1 |
|
return strval($this->encoding); |
67
|
|
|
} |
68
|
|
|
|
69
|
1 |
|
public function getType(): int |
70
|
|
|
{ |
71
|
1 |
|
return intval($this->type); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|