Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
66 | 25 | public function isReference( |
|
67 | mixed $value, |
||
68 | array $registeredVariables = [] |
||
69 | ): bool { |
||
70 | 25 | $variables = ''; |
|
71 | 25 | if (!empty($registeredVariables)) { |
|
72 | 23 | $variables = implode('|', $registeredVariables); |
|
73 | } |
||
74 | |||
75 | 25 | if (! is_string($value) || empty($value)) { |
|
76 | 2 | return false; |
|
77 | } |
||
78 | |||
79 | 25 | return (bool) preg_match( |
|
80 | 25 | '/^(' |
|
81 | 25 | . $variables |
|
82 | 25 | . '|CURRENT|NEW|OLD)(\[\`.+\`\]|\[[\d\w\*]*\])*(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/', |
|
83 | $value |
||
84 | ); |
||
87 |