1 | <?php |
||
5 | class Header |
||
6 | { |
||
7 | /** |
||
8 | * @var Cron |
||
9 | */ |
||
10 | private $cron; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $path; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $mailTo; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $home; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $shell; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $contentType; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $encoding; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | private $timezone; |
||
46 | |||
47 | /** |
||
48 | * @param Cron $cron |
||
49 | */ |
||
50 | public function __construct(Cron $cron) |
||
54 | |||
55 | /** |
||
56 | * Works just like the shell PATH, but it does not inherit from your environment. |
||
57 | * |
||
58 | * @param string $path |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function setPath($path) |
||
68 | |||
69 | /** |
||
70 | * @param string $home |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function setHome($home) |
||
80 | |||
81 | /** |
||
82 | * @param string $email |
||
83 | * |
||
84 | * @return $this |
||
85 | * |
||
86 | * @throws InvalidEmail if given email is invalid |
||
87 | */ |
||
88 | public function setMailto($email) |
||
95 | |||
96 | private function assertValidEmail($email) |
||
102 | |||
103 | /** |
||
104 | * Set the shell to be used when executing commands |
||
105 | * |
||
106 | * Default is /bin/sh but can also be changed to /bin/php |
||
107 | * |
||
108 | * @param string $shell |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function setShell($shell) |
||
118 | |||
119 | /** |
||
120 | * Set the content-type to use for cron output emails. |
||
121 | * |
||
122 | * @param string $contentType |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function setContentType($contentType) |
||
132 | |||
133 | /** |
||
134 | * Set the charset to use for cron output emails. |
||
135 | * |
||
136 | * @param string $encoding |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | public function setContentTransferEncoding($encoding) |
||
146 | |||
147 | /** |
||
148 | * @param $timezone |
||
149 | * |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function setTimezone($timezone) |
||
158 | |||
159 | /** |
||
160 | * @return string |
||
161 | */ |
||
162 | public function format() |
||
189 | |||
190 | private function createHeader($name, $value) |
||
194 | |||
195 | /** |
||
196 | * @return Cron |
||
197 | */ |
||
198 | public function end() |
||
202 | } |
||
203 |