| Conditions | 4 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4.0047 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 4 | public function applyToNode(Node $node) |
|
| 21 | { |
||
| 22 | 4 | $instruction = $node->getInstruction($this); |
|
| 23 | |||
| 24 | 4 | if(!isset($instruction->date)) { |
|
|
|
|||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | 4 | $format = 'Y-m-d'; |
|
| 29 | 4 | if (isset($instruction->format)) { |
|
| 30 | 4 | $format = $instruction->format; |
|
| 31 | 4 | } |
|
| 32 | |||
| 33 | 4 | $date = new \DateTime($instruction->date); |
|
| 34 | 4 | if (isset($instruction->timezone)) { |
|
| 35 | 1 | $date = new \DateTime($instruction->date, new \DateTimeZone($instruction->timezone)); |
|
| 36 | 1 | } |
|
| 37 | |||
| 38 | 4 | $result = $date->format($format); |
|
| 39 | |||
| 40 | 4 | $node->setResult($result); |
|
| 41 | 4 | } |
|
| 42 | } |
||
| 43 |