Total Complexity | 15 |
Total Lines | 75 |
Duplicated Lines | 0 % |
Coverage | 92.86% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait ValidatesReferences |
||
8 | { |
||
9 | 7 | public function isBind(mixed $value): bool |
|
10 | { |
||
11 | 7 | if (is_string($value)) { |
|
12 | 6 | return true; |
|
13 | } |
||
14 | 1 | if (is_object($value)) { |
|
15 | return true; |
||
16 | } |
||
17 | |||
18 | 1 | return false; |
|
19 | } |
||
20 | |||
21 | 1 | public function isCollectionBind(mixed $value): bool |
|
28 | } |
||
29 | |||
30 | 30 | public function isVariable(mixed $value): bool |
|
31 | { |
||
32 | 30 | if (is_string($value) && preg_match('/^\$?[a-zA-Z_][a-zA-Z0-9_]*+$/', $value)) { |
|
33 | 30 | return true; |
|
34 | } |
||
35 | |||
36 | 5 | return false; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param array<array-key, mixed> $registeredVariables |
||
|
|||
41 | */ |
||
42 | 1 | public function isRegisteredVariable( |
|
43 | int|string $value, |
||
44 | array $registeredVariables = [] |
||
45 | ): bool { |
||
46 | 1 | return isset($registeredVariables[$value]); |
|
47 | } |
||
48 | |||
49 | 1 | public function isAttribute(mixed $value): bool |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param array<array-key, null|object|scalar> $registeredVariables |
||
65 | */ |
||
66 | 27 | public function isReference( |
|
85 |