-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttachment.php
53 lines (46 loc) · 1.09 KB
/
Attachment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* @author stev leibelt <artodeto@bazzline.net>
* @since 2016-02-18
*/
namespace De\Leibelt\SendMail\DomainModel;
use InvalidArgumentException;
final class Attachment
{
private null|string $contentType;
private string $name;
private string $path;
/**
* Attachment constructor.
* @param string $name
* @param string $path
* @param null|string $contentType
* @throws InvalidArgumentException
*/
public function __construct(
string $name,
string $path,
string $contentType = null
) {
$this->contentType = $contentType;
$this->name = $name;
$this->path = $path;
if (!is_readable($path)) {
throw new InvalidArgumentException(
'provided path is not readable: ' . $path
);
}
}
public function contentType(): null|string
{
return $this->contentType;
}
public function name(): string
{
return $this->name;
}
public function path(): string
{
return $this->path;
}
}