| Total Complexity | 8 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 13 | class Rule |
||
| 14 | { |
||
| 15 | private string $rule; |
||
| 16 | private Parser\Parser $parser; |
||
|
|
|||
| 17 | private string $parsedRule = ''; |
||
| 18 | private string $error = ''; |
||
| 19 | private static object $container; |
||
| 20 | |||
| 21 | public function __construct(string $rule, array $variables = []) |
||
| 22 | { |
||
| 23 | if (!isset(self::$container)) { |
||
| 24 | self::$container = require __DIR__ . '/container.php'; |
||
| 25 | } |
||
| 26 | 280 | ||
| 27 | $this->parser = self::$container->parser($variables); |
||
| 28 | 280 | $this->rule = $rule; |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | public function isTrue(): bool |
||
| 32 | 280 | { |
|
| 33 | 280 | /** @var EvaluatorInterface $evaluator */ |
|
| 34 | 280 | $evaluator = self::$container->evaluator(); |
|
| 35 | |||
| 36 | 212 | return $evaluator->evaluate( |
|
| 37 | $this->parsedRule ?: |
||
| 38 | $this->parser->parse($this->rule) |
||
| 39 | 212 | ); |
|
| 40 | } |
||
| 41 | 212 | ||
| 42 | 212 | public function isFalse(): bool |
|
| 43 | 212 | { |
|
| 44 | return !$this->isTrue(); |
||
| 45 | } |
||
| 46 | |||
| 47 | 2 | /** |
|
| 48 | * Tells whether a rule is valid (as in "can be parsed without error") or not. |
||
| 49 | 2 | */ |
|
| 50 | public function isValid(): bool |
||
| 51 | { |
||
| 52 | try { |
||
| 53 | $this->parsedRule = $this->parser->parse($this->rule); |
||
| 54 | } catch (Exception $e) { |
||
| 55 | 74 | $this->error = $e->getMessage(); |
|
| 56 | return false; |
||
| 57 | } |
||
| 58 | 74 | ||
| 59 | 68 | return true; |
|
| 60 | 68 | } |
|
| 61 | 68 | ||
| 62 | public function getError(): string |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
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