| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function interpolate(&$data) |
||
| 19 | { |
||
| 20 | if (is_array($data)) { |
||
| 21 | foreach ($data as &$item) { |
||
| 22 | $this->interpolate($item); |
||
| 23 | } |
||
| 24 | } elseif (is_string($data)) { |
||
| 25 | $data = preg_replace_callback('/\\$(\\w+)\\[\'(.+?)\'\\]/', function ($matches) { |
||
| 26 | return $this->get($matches[1], $matches[2]); |
||
| 27 | }, $data); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 51 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: