@@ 154-169 (lines=16) @@ | ||
151 | return false; |
|
152 | } |
|
153 | ||
154 | protected function testHour($part) |
|
155 | { |
|
156 | // Sometimes years get parsed as hours |
|
157 | if (ctype_digit($part) && $part <= 23) { |
|
158 | return true; |
|
159 | } else if (preg_match('/^\d{1,2}:\d{1,2}:\d{1,2}$/', $part)) { |
|
160 | return true; |
|
161 | } else if (ctype_digit($part) && $part > 24) { |
|
162 | return false; |
|
163 | } |
|
164 | $parse = date_parse($part); |
|
165 | if (!empty($parse) && $parse['hour'] !== false && $parse['error_count'] == 0 ) { |
|
166 | return true; |
|
167 | } |
|
168 | return false; |
|
169 | } |
|
170 | ||
171 | protected function testMinute($part) |
|
172 | { |
|
@@ 171-187 (lines=17) @@ | ||
168 | return false; |
|
169 | } |
|
170 | ||
171 | protected function testMinute($part) |
|
172 | { |
|
173 | // Sometimes years get parsed as minutes |
|
174 | if (ctype_digit($part) && $part <= 60) { |
|
175 | return true; |
|
176 | } else if (preg_match('/^\d{1,2}:\d{1,2}:\d{1,2}$/', $part)) { |
|
177 | return true; |
|
178 | } else if (ctype_digit($part) && $part > 60) { |
|
179 | return false; |
|
180 | } |
|
181 | $parse = date_parse($part); |
|
182 | if (!empty($parse) && $parse['minute'] !== false && $parse['error_count'] == 0 ) { |
|
183 | return true; |
|
184 | ||
185 | } |
|
186 | return false; |
|
187 | } |
|
188 | ||
189 | protected function testSeconds($part) |
|
190 | { |
|
@@ 189-204 (lines=16) @@ | ||
186 | return false; |
|
187 | } |
|
188 | ||
189 | protected function testSeconds($part) |
|
190 | { |
|
191 | // Sometimes years get parsed as seconds |
|
192 | if (ctype_digit($part) && $part <= 60) { |
|
193 | return true; |
|
194 | } else if (preg_match('/^\d{1,2}:\d{1,2}:\d{1,2}$/', $part)) { |
|
195 | return true; |
|
196 | } else if (ctype_digit($part) && $part > 60) { |
|
197 | return false; |
|
198 | } |
|
199 | $parse = date_parse($part); |
|
200 | if (!empty($parse) && $parse['second'] !== false && $parse['error_count'] == 0 ) { |
|
201 | return true; |
|
202 | } |
|
203 | return false; |
|
204 | } |
|
205 | ||
206 | } |
|
207 |