1 | <?php |
||
26 | class StringHelper |
||
27 | { |
||
28 | /** |
||
29 | * The bool variants available in .env |
||
30 | * |
||
31 | * @var array $bool_variants |
||
32 | */ |
||
33 | private static $bool_variants = array( |
||
34 | 'true', 'false', 'yes', 'no' |
||
35 | ); |
||
36 | |||
37 | /** |
||
38 | * Returns if value starts with a value |
||
39 | * |
||
40 | * @param string $string The value to search for |
||
41 | * @param string $line The line to test |
||
42 | * |
||
43 | * @return bool Returns if the line starts with value |
||
44 | */ |
||
45 | 54 | public function startsWith($string, $line) |
|
49 | |||
50 | /** |
||
51 | * Returns if value is a string |
||
52 | * |
||
53 | * @param string $value The value to test |
||
54 | * |
||
55 | * @return bool Is a value a string |
||
56 | */ |
||
57 | 42 | public function isString($value) |
|
61 | |||
62 | /** |
||
63 | * Returns if value is a bool |
||
64 | * |
||
65 | * @param string $value The value to test |
||
66 | * |
||
67 | * @return bool Is a value a bool |
||
68 | */ |
||
69 | 39 | public function isBool($value) |
|
73 | |||
74 | /** |
||
75 | * Returns if the bool is in a string |
||
76 | * |
||
77 | * @param string $value The value to test |
||
78 | * @param bool $quoted_string Is the context a quoted string |
||
79 | * @param int $word_count The amount of words in the sentence |
||
80 | * |
||
81 | * @return bool Is a value a bool in a string |
||
82 | */ |
||
83 | 12 | public function isBoolInString($value, $quoted_string, $word_count) |
|
87 | |||
88 | /** |
||
89 | * Returns if value is number |
||
90 | * |
||
91 | * @param string $value The value to test |
||
92 | * |
||
93 | * @return bool Is a value a number |
||
94 | */ |
||
95 | 36 | public function isNumber($value) |
|
99 | |||
100 | /** |
||
101 | * Returns if value is null |
||
102 | * |
||
103 | * @param string $value The value to test |
||
104 | * |
||
105 | * @return bool Is a value null |
||
106 | */ |
||
107 | 36 | public function isNull($value) |
|
111 | |||
112 | /** |
||
113 | * Returns if variable value is a clone, e.g. BOOL = $(BOOL_1) |
||
114 | * |
||
115 | * @param string $value The value to test |
||
116 | * @param array $matches The matches of the variables |
||
117 | * @param bool $quoted_string If the value is in a quoted string |
||
118 | * |
||
119 | * @return bool Is a value null |
||
120 | */ |
||
121 | 18 | public function isVariableClone($value, $matches, $quoted_string) |
|
125 | } |
||
126 |