@@ -122,7 +122,7 @@ public function parse(): array
122122 {
123123 if (!in_array ($ arg , $ this ->checked ) && $ index != 0 )
124124 {
125- $ this ->is_opt ($ arg , $ index , TRUE );
125+ $ this ->isOpt ($ arg , $ index , TRUE );
126126 }
127127 }
128128
@@ -132,9 +132,21 @@ public function parse(): array
132132 /**
133133 * Check whether the parsed command line was valid or not.
134134 *
135+ * @deprecated Use isInvalidCommandline() instead
136+ *
135137 * @return bool TRUE if the command line was invalid, FALSE otherwise
136138 */
137139 public function is_invalid_commandline (): bool
140+ {
141+ return $ this ->isInvalidCommandline ();
142+ }
143+
144+ /**
145+ * Check whether the parsed command line was valid or not.
146+ *
147+ * @return bool TRUE if the command line was invalid, FALSE otherwise
148+ */
149+ public function isInvalidCommandline (): bool
138150 {
139151 return $ this ->error ;
140152 }
@@ -149,31 +161,31 @@ public function is_invalid_commandline(): bool
149161 *
150162 * @return bool Success or Failure
151163 */
152- private function is_opt (string $ opt , int $ index , bool $ toplevel = FALSE ): bool
164+ private function isOpt (string $ opt , int $ index , bool $ toplevel = FALSE ): bool
153165 {
154166 array_push ($ this ->checked , $ opt );
155167
156168 if (isset ($ opt [0 ]) && $ opt [0 ] == '- ' )
157169 {
158170 if (strlen ($ opt ) < 1 )
159171 {
160- return $ this ->is_valid_short ($ opt , $ index );
172+ return $ this ->isValidShort ($ opt , $ index );
161173 }
162174
163175 $ param = substr ($ opt , 1 );
164176
165177 if (isset ($ param [0 ]) && $ param [0 ] != '- ' )
166178 {
167- return $ this ->is_valid_short ($ param , $ index );
179+ return $ this ->isValidShort ($ param , $ index );
168180 }
169181
170182 if (strlen ($ param ) > 1 )
171183 {
172- return $ this ->is_valid_long (substr ($ param , 1 ), $ index );
184+ return $ this ->isValidLong (substr ($ param , 1 ), $ index );
173185 }
174186 else
175187 {
176- return $ this ->is_valid_long ($ opt , $ index );
188+ return $ this ->isValidLong ($ opt , $ index );
177189 }
178190 }
179191 elseif ($ toplevel )
@@ -192,7 +204,7 @@ private function is_opt(string $opt, int $index, bool $toplevel = FALSE): bool
192204 *
193205 * @return bool Success or Failure
194206 */
195- private function is_valid_short (string $ opt , int $ index ): bool
207+ private function isValidShort (string $ opt , int $ index ): bool
196208 {
197209 $ pos = strpos ($ this ->short , $ opt );
198210
@@ -205,7 +217,7 @@ private function is_valid_short(string $opt, int $index): bool
205217
206218 $ this ->ast [$ opt ] = [];
207219
208- return $ this ->check_argument ($ opt , $ index , $ pos , $ this ->short );
220+ return $ this ->checkArgument ($ opt , $ index , $ pos , $ this ->short );
209221 }
210222
211223 /**
@@ -216,7 +228,7 @@ private function is_valid_short(string $opt, int $index): bool
216228 *
217229 * @return bool Success or Failure
218230 */
219- private function is_valid_long (string $ opt , int $ index ): bool
231+ private function isValidLong (string $ opt , int $ index ): bool
220232 {
221233 $ match = FALSE ;
222234 $ args = '' ;
@@ -247,7 +259,7 @@ private function is_valid_long(string $opt, int $index): bool
247259
248260 $ this ->ast [$ opt ] = [];
249261
250- return $ this ->check_argument ($ opt , $ index , strlen ($ opt ) - 1 , $ this ->long [$ args ]);
262+ return $ this ->checkArgument ($ opt , $ index , strlen ($ opt ) - 1 , $ this ->long [$ args ]);
251263 }
252264
253265 /**
@@ -261,7 +273,7 @@ private function is_valid_long(string $opt, int $index): bool
261273 *
262274 * @return bool Success or Failure
263275 */
264- private function check_argument (string $ opt , int $ index , int $ pos , string $ a ): bool
276+ private function checkArgument (string $ opt , int $ index , int $ pos , string $ a ): bool
265277 {
266278 $ next = $ index + 1 ;
267279
@@ -276,7 +288,7 @@ private function check_argument(string $opt, int $index, int $pos, string $a): b
276288
277289 if (count ($ this ->args ) > $ next && strlen ($ this ->args [$ next ]) != 0 )
278290 {
279- if (!$ this ->is_opt ($ this ->args [$ next ], $ next ) && $ this ->args [$ next ][0 ] != '- ' )
291+ if (!$ this ->isOpt ($ this ->args [$ next ], $ next ) && $ this ->args [$ next ][0 ] != '- ' )
280292 {
281293 array_push ($ this ->ast [$ opt ], $ this ->args [$ next ]);
282294
@@ -287,7 +299,7 @@ private function check_argument(string $opt, int $index, int $pos, string $a): b
287299
288300 if (($ type == ': ' && $ a [$ pos + 2 ] == ': ' ) || $ a [$ pos + 2 ] == '; ' )
289301 {
290- return $ this ->check_argument ($ opt , $ next , $ pos + 1 , $ a );
302+ return $ this ->checkArgument ($ opt , $ next , $ pos + 1 , $ a );
291303 }
292304 else
293305 {
0 commit comments