1 | <?php |
||
2 | |||
3 | namespace Popy\Calendar\Parser\SymbolParser; |
||
4 | |||
5 | use Popy\Calendar\Parser\FormatToken; |
||
6 | use Popy\Calendar\Parser\SymbolParserInterface; |
||
7 | use Popy\Calendar\Parser\FormatParserInterface; |
||
8 | |||
9 | /** |
||
10 | * Implementation of the native DateTime recursive formats using preg lexers. |
||
11 | */ |
||
12 | class PregNativeRecursive implements SymbolParserInterface |
||
13 | { |
||
14 | /** |
||
15 | * @inheritDoc |
||
16 | */ |
||
17 | public function parseSymbol(FormatToken $token, FormatParserInterface $parser) |
||
18 | { |
||
19 | if ($token->is('c')) { |
||
20 | // c ISO 8601 date (added in PHP 5) 2004-02-12T15:19:21+00:00 |
||
0 ignored issues
–
show
|
|||
21 | return $parser->parseFormat('Y-m-d\TH:i:sP', true); |
||
22 | } |
||
23 | |||
24 | if ($token->is('r')) { |
||
25 | // r RFC 2822 formatted date Example: Thu, 21 Dec 2000 16:01:07 +0200 |
||
26 | return $parser->parseFormat('D, d M Y H:i:s O', true); |
||
27 | } |
||
28 | } |
||
29 | } |
||
30 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.