@@ -24,15 +24,15 @@ |
||
24 | 24 | class InvalidEmailAddress extends RuntimeException implements ChainmailException |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * Create an InvalidEmailAddress exception based on a specific email. |
|
29 | - * |
|
30 | - * @param string $email Email that failed validation. |
|
31 | - * |
|
32 | - * @return static |
|
33 | - */ |
|
34 | - public static function from($email) |
|
35 | - { |
|
36 | - return new static(sprintf('Invalid email address: "%1$s".', $email)); |
|
37 | - } |
|
27 | + /** |
|
28 | + * Create an InvalidEmailAddress exception based on a specific email. |
|
29 | + * |
|
30 | + * @param string $email Email that failed validation. |
|
31 | + * |
|
32 | + * @return static |
|
33 | + */ |
|
34 | + public static function from($email) |
|
35 | + { |
|
36 | + return new static(sprintf('Invalid email address: "%1$s".', $email)); |
|
37 | + } |
|
38 | 38 | } |
@@ -24,15 +24,15 @@ |
||
24 | 24 | class InvalidDomain extends RuntimeException implements ChainmailException |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * Create an InvalidDomain exception based on a specific domain. |
|
29 | - * |
|
30 | - * @param string $domain Email that failed validation. |
|
31 | - * |
|
32 | - * @return static |
|
33 | - */ |
|
34 | - public static function from($domain) |
|
35 | - { |
|
36 | - return new static(sprintf('Invalid domain name: "%1$s".', $domain)); |
|
37 | - } |
|
27 | + /** |
|
28 | + * Create an InvalidDomain exception based on a specific domain. |
|
29 | + * |
|
30 | + * @param string $domain Email that failed validation. |
|
31 | + * |
|
32 | + * @return static |
|
33 | + */ |
|
34 | + public static function from($domain) |
|
35 | + { |
|
36 | + return new static(sprintf('Invalid domain name: "%1$s".', $domain)); |
|
37 | + } |
|
38 | 38 | } |
@@ -25,30 +25,30 @@ |
||
25 | 25 | class Recipients extends ArrayCollection |
26 | 26 | { |
27 | 27 | |
28 | - public function __construct(array $emails) |
|
29 | - { |
|
30 | - parent::__construct(array_filter( |
|
31 | - array_map(function ($value) { |
|
32 | - if ($value instanceof EmailAddress) { |
|
33 | - return $value; |
|
34 | - } |
|
28 | + public function __construct(array $emails) |
|
29 | + { |
|
30 | + parent::__construct(array_filter( |
|
31 | + array_map(function ($value) { |
|
32 | + if ($value instanceof EmailAddress) { |
|
33 | + return $value; |
|
34 | + } |
|
35 | 35 | |
36 | - return new EmailAddress($value); |
|
37 | - }, $emails) |
|
38 | - )); |
|
39 | - } |
|
36 | + return new EmailAddress($value); |
|
37 | + }, $emails) |
|
38 | + )); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Add an email address to the Recipients collection. |
|
43 | - * |
|
44 | - * @param mixed $email Email address to add. |
|
45 | - * |
|
46 | - * @return static |
|
47 | - */ |
|
48 | - public function add($email) |
|
49 | - { |
|
50 | - parent::add(new EmailAddress($email)); |
|
41 | + /** |
|
42 | + * Add an email address to the Recipients collection. |
|
43 | + * |
|
44 | + * @param mixed $email Email address to add. |
|
45 | + * |
|
46 | + * @return static |
|
47 | + */ |
|
48 | + public function add($email) |
|
49 | + { |
|
50 | + parent::add(new EmailAddress($email)); |
|
51 | 51 | |
52 | - return $this; |
|
53 | - } |
|
52 | + return $this; |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function __construct(array $emails) |
29 | 29 | { |
30 | 30 | parent::__construct(array_filter( |
31 | - array_map(function ($value) { |
|
31 | + array_map(function($value) { |
|
32 | 32 | if ($value instanceof EmailAddress) { |
33 | 33 | return $value; |
34 | 34 | } |
@@ -25,47 +25,47 @@ |
||
25 | 25 | interface Mail extends Renderable |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Set the template that the email will use. |
|
30 | - * |
|
31 | - * @since 1.0.0 |
|
32 | - * |
|
33 | - * @param string|Template $template Template to use. |
|
34 | - * |
|
35 | - * @return Mail |
|
36 | - */ |
|
37 | - public function setTemplate($template); |
|
28 | + /** |
|
29 | + * Set the template that the email will use. |
|
30 | + * |
|
31 | + * @since 1.0.0 |
|
32 | + * |
|
33 | + * @param string|Template $template Template to use. |
|
34 | + * |
|
35 | + * @return Mail |
|
36 | + */ |
|
37 | + public function setTemplate($template); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Get the instance of the template. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - * |
|
44 | - * @return Template |
|
45 | - */ |
|
46 | - public function getTemplate(); |
|
39 | + /** |
|
40 | + * Get the instance of the template. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + * |
|
44 | + * @return Template |
|
45 | + */ |
|
46 | + public function getTemplate(); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Add a section to the Mail. |
|
50 | - * |
|
51 | - * @since 1.0.0 |
|
52 | - * |
|
53 | - * @param string $type Type of section to add. |
|
54 | - * @param string $content Content of the section. |
|
55 | - * |
|
56 | - * @return Mail |
|
57 | - * @throws RuntimeException |
|
58 | - */ |
|
59 | - public function addSection($type, $content); |
|
48 | + /** |
|
49 | + * Add a section to the Mail. |
|
50 | + * |
|
51 | + * @since 1.0.0 |
|
52 | + * |
|
53 | + * @param string $type Type of section to add. |
|
54 | + * @param string $content Content of the section. |
|
55 | + * |
|
56 | + * @return Mail |
|
57 | + * @throws RuntimeException |
|
58 | + */ |
|
59 | + public function addSection($type, $content); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Send the email to one or more recipients. |
|
63 | - * |
|
64 | - * @since 1.0.0 |
|
65 | - * |
|
66 | - * @param Recipients|EmailAddress|array|string $recipients |
|
67 | - * |
|
68 | - * @return Mail |
|
69 | - */ |
|
70 | - public function sendTo($recipients); |
|
61 | + /** |
|
62 | + * Send the email to one or more recipients. |
|
63 | + * |
|
64 | + * @since 1.0.0 |
|
65 | + * |
|
66 | + * @param Recipients|EmailAddress|array|string $recipients |
|
67 | + * |
|
68 | + * @return Mail |
|
69 | + */ |
|
70 | + public function sendTo($recipients); |
|
71 | 71 | } |
@@ -25,79 +25,79 @@ |
||
25 | 25 | class EmailAddress |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * The local part of the email address (before the '@' sign). |
|
30 | - * |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - protected $localPart; |
|
28 | + /** |
|
29 | + * The local part of the email address (before the '@' sign). |
|
30 | + * |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + protected $localPart; |
|
34 | 34 | |
35 | - /** |
|
36 | - * The domain part of the email address (after the '@' sign). |
|
37 | - * |
|
38 | - * @var Domain |
|
39 | - */ |
|
40 | - protected $domain; |
|
35 | + /** |
|
36 | + * The domain part of the email address (after the '@' sign). |
|
37 | + * |
|
38 | + * @var Domain |
|
39 | + */ |
|
40 | + protected $domain; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Instantiate an EmailAddress object. |
|
44 | - * |
|
45 | - * @param EmailAddress|string $email The email to parse. |
|
46 | - * |
|
47 | - * @throws InvalidEmailAddress If the email is not valid. |
|
48 | - */ |
|
49 | - public function __construct($email) |
|
50 | - { |
|
51 | - if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
52 | - throw InvalidEmailAddress::from($email); |
|
53 | - } |
|
42 | + /** |
|
43 | + * Instantiate an EmailAddress object. |
|
44 | + * |
|
45 | + * @param EmailAddress|string $email The email to parse. |
|
46 | + * |
|
47 | + * @throws InvalidEmailAddress If the email is not valid. |
|
48 | + */ |
|
49 | + public function __construct($email) |
|
50 | + { |
|
51 | + if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
52 | + throw InvalidEmailAddress::from($email); |
|
53 | + } |
|
54 | 54 | |
55 | - try { |
|
56 | - $parts = explode('@', $email); |
|
57 | - $this->localPart = trim($parts[0]); |
|
58 | - $this->domain = new Domain(trim($parts[1])); |
|
59 | - } catch (Exception $exception) { |
|
60 | - throw InvalidEmailAddress::from($email); |
|
61 | - } |
|
62 | - } |
|
55 | + try { |
|
56 | + $parts = explode('@', $email); |
|
57 | + $this->localPart = trim($parts[0]); |
|
58 | + $this->domain = new Domain(trim($parts[1])); |
|
59 | + } catch (Exception $exception) { |
|
60 | + throw InvalidEmailAddress::from($email); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Returns the local part of the email address. |
|
66 | - * |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function getLocalPart() |
|
70 | - { |
|
71 | - return $this->localPart; |
|
72 | - } |
|
64 | + /** |
|
65 | + * Returns the local part of the email address. |
|
66 | + * |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function getLocalPart() |
|
70 | + { |
|
71 | + return $this->localPart; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Returns the domain part of the email address. |
|
76 | - * |
|
77 | - * @return Domain |
|
78 | - */ |
|
79 | - public function getDomainPart() |
|
80 | - { |
|
81 | - return $this->domain; |
|
82 | - } |
|
74 | + /** |
|
75 | + * Returns the domain part of the email address. |
|
76 | + * |
|
77 | + * @return Domain |
|
78 | + */ |
|
79 | + public function getDomainPart() |
|
80 | + { |
|
81 | + return $this->domain; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Returns the entire email address. |
|
86 | - * |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function getAddress() |
|
90 | - { |
|
91 | - return $this->getLocalPart() . '@' . $this->getDomainPart(); |
|
92 | - } |
|
84 | + /** |
|
85 | + * Returns the entire email address. |
|
86 | + * |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function getAddress() |
|
90 | + { |
|
91 | + return $this->getLocalPart() . '@' . $this->getDomainPart(); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Convert the EmailAddress object to a string. |
|
96 | - * |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function __toString() |
|
100 | - { |
|
101 | - return $this->getAddress(); |
|
102 | - } |
|
94 | + /** |
|
95 | + * Convert the EmailAddress object to a string. |
|
96 | + * |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function __toString() |
|
100 | + { |
|
101 | + return $this->getAddress(); |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | \ No newline at end of file |
@@ -88,7 +88,7 @@ |
||
88 | 88 | */ |
89 | 89 | public function getAddress() |
90 | 90 | { |
91 | - return $this->getLocalPart() . '@' . $this->getDomainPart(); |
|
91 | + return $this->getLocalPart().'@'.$this->getDomainPart(); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |