Conditions | 6 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
22 | 4 | private function variable(): void |
|
23 | { |
||
24 | 4 | if (preg_match_all($this->pattern, $this->content, $matches, PREG_SET_ORDER)) { |
|
25 | 4 | for ($i = 0; $i < count($matches); $i++) { |
|
26 | 4 | $explode = explode('.', $matches[$i][1]); |
|
27 | |||
28 | 4 | $variable = $explode[0]; |
|
29 | |||
30 | 4 | $variable = '$'.$variable; |
|
31 | |||
32 | 4 | for ($k = 1; $k < count($explode); $k++) { |
|
33 | 2 | $variable .= "['".$explode[$k]."']"; |
|
34 | } |
||
35 | |||
36 | 4 | $content = '<?php echo('.$variable.'); ?>'; |
|
37 | |||
38 | 4 | if (isset($matches[$i][2]) && $matches[$i][2] == 'upper') { |
|
39 | 2 | $content = '<?php echo(ucwords('.$variable.')); ?>'; |
|
40 | } |
||
41 | |||
42 | 4 | $this->content = str_replace($matches[$i][0], $content, $this->content); |
|
43 | }; |
||
47 |