1 | <?php |
||
5 | class Header |
||
6 | { |
||
7 | /** @var Cron */ |
||
8 | private $cron; |
||
9 | |||
10 | /** @var string */ |
||
11 | private $path; |
||
12 | |||
13 | /** @var string */ |
||
14 | private $mailTo; |
||
15 | |||
16 | /** @var string */ |
||
17 | private $home; |
||
18 | |||
19 | /** @var string */ |
||
20 | private $shell; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $contentType; |
||
24 | |||
25 | /** @var string */ |
||
26 | private $encoding; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $timezone; |
||
30 | |||
31 | public function __construct(Cron $cron) |
||
35 | |||
36 | /** |
||
37 | * Works just like the shell PATH, but it does not inherit from your environment. |
||
38 | */ |
||
39 | public function setPath(string $path): self |
||
45 | |||
46 | public function setHome(string $home): self |
||
52 | |||
53 | /** @throws InvalidEmail if given email is invalid */ |
||
54 | public function setMailto(string $email): self |
||
61 | |||
62 | private function assertValidEmail($email): void |
||
68 | |||
69 | /** |
||
70 | * Set the shell to be used when executing commands |
||
71 | * |
||
72 | * Default is /bin/sh but can also be changed to /bin/php |
||
73 | */ |
||
74 | public function setShell(string $shell): self |
||
80 | |||
81 | /** |
||
82 | * Set the content-type to use for cron output emails. |
||
83 | */ |
||
84 | public function setContentType(string $contentType): self |
||
90 | |||
91 | /** |
||
92 | * Set the charset to use for cron output emails. |
||
93 | */ |
||
94 | public function setContentTransferEncoding(string $encoding): self |
||
100 | |||
101 | public function setTimezone(string $timezone): self |
||
107 | |||
108 | public function format(): string |
||
136 | |||
137 | private function createHeader($name, $value): string |
||
141 | |||
142 | public function end(): Cron |
||
146 | } |
||
147 |