| Total Complexity | 9 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class VariableTag extends Tag |
||
|
|
|||
| 7 | { |
||
| 8 | private $pattern = '/{\s?([\w]+.?[\w]+.?[\w]+)\s?\|?\s?([\w]+)?\s?}/is'; |
||
| 9 | private $match = []; |
||
| 10 | private $matches = []; |
||
| 11 | private $replace = ''; |
||
| 12 | private $variable = ''; |
||
| 13 | |||
| 14 | public function handle(): void |
||
| 15 | { |
||
| 16 | if (preg_match_all($this->pattern, self::$content, $this->matches, PREG_SET_ORDER)) { |
||
| 17 | for ($i = 0; $i < count($this->matches); $i++) { |
||
| 18 | $this->match = $this->matches[$i]; |
||
| 19 | $this->getVariable(); |
||
| 20 | $this->replace = '<?php echo('.$this->variable.'); ?>'; |
||
| 21 | $this->filter('upper'); |
||
| 22 | self::$content = str_replace($this->match[0], $this->replace, self::$content); |
||
| 23 | }; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | private function getVariable(): void |
||
| 28 | { |
||
| 29 | $explode = explode('.', $this->match[1]); |
||
| 30 | |||
| 31 | $variable = $explode[0]; |
||
| 32 | |||
| 33 | $variable = '$'.$variable; |
||
| 34 | |||
| 35 | for ($k = 1; $k < count($explode); $k++) { |
||
| 36 | $variable .= "->".$explode[$k]; |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->variable = $variable; |
||
| 40 | } |
||
| 41 | |||
| 42 | private function filter(string $name): void |
||
| 45 | } |
||
| 46 | |||
| 47 | private function upper(): void |
||
| 54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths