| Conditions | 4 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function applyToNode(Node $node) |
||
| 31 | { |
||
| 32 | $instruction = $node->getInstruction($this); |
||
| 33 | |||
| 34 | if(!isset($instruction->date)) { |
||
|
|
|||
| 35 | return; |
||
| 36 | } |
||
| 37 | |||
| 38 | $format = 'Y-m-d'; |
||
| 39 | if (isset($instruction->format)) { |
||
| 40 | $format = $instruction->format; |
||
| 41 | } |
||
| 42 | |||
| 43 | $date = new \DateTime($instruction->date); |
||
| 44 | if (isset($instruction->timezone)) { |
||
| 45 | $date = new \DateTime($instruction->date, new \DateTimeZone($instruction->timezone)); |
||
| 46 | } |
||
| 47 | |||
| 48 | $result = $date->format($format); |
||
| 49 | |||
| 50 | $node->setResult($result); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |