| Conditions | 6 |
| Paths | 9 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 34 | public function applyToNode(Node $node) |
||
| 35 | { |
||
| 36 | $transformations = (array)$node->getInstruction($this); |
||
| 37 | |||
| 38 | if (!isset($node->input)) { |
||
| 39 | return; |
||
| 40 | } |
||
| 41 | |||
| 42 | $value = $node->input; |
||
| 43 | |||
| 44 | if ($value instanceof Node) { |
||
| 45 | $value = $value->getResult(); |
||
| 46 | } |
||
| 47 | |||
| 48 | foreach ($transformations as $transformation) { |
||
| 49 | list($fn, $arg) = explode(':', $transformation) + [null]; |
||
| 50 | |||
| 51 | if (!in_array($fn, $this->allowed)) { |
||
| 52 | trigger_error("Unknown transformation '$transformation'", E_USER_WARNING); |
||
| 53 | continue; |
||
| 54 | } |
||
| 55 | |||
| 56 | $value = isset($arg) ? $fn($arg, $value) : $fn($value); |
||
| 57 | } |
||
| 58 | |||
| 59 | $node->setResult($value); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |