@@ -62,26 +62,26 @@ public static function parse(array $argv = null): array {
6262 $ opt = true ;
6363 }
6464
65- if ($ opt ) {
66- if (str_contains ($ entry , '= ' )) {
67- $ split = explode ('= ' , $ entry );
68- $ opts [trim ($ split [0 ], " \t\n\r\0\x0B- " )] = trim ($ split [1 ]);
69- } else if ($ len > ($ i + 1 ) && !str_starts_with ($ inArgs [$ i + 1 ], '- ' )) {
70- $ val = '' ;
71-
72- while ($ len > ($ i + 1 ) && !str_starts_with ($ inArgs [$ i + 1 ], '- ' )) {
73- $ val .= $ inArgs [$ i + 1 ] . ' ' ;
74- $ i ++;
75- }
76-
77- $ opts [trim ($ entry , " \t\n\r\0\x0B- " )] = trim ($ val , " \t\n\r\0\x0B\"" );
78- } else {
79- $ opts [trim ($ entry , " \t\n\r\0\x0B- " )] = null ;
80- }
65+ if (!$ opt ) {
66+ $ args [] = trim ($ entry , " \t\n\r\0\x0B\"" );
8167 continue ;
8268 }
8369
84- $ args [] = trim ($ entry , " \t\n\r\0\x0B\"" );
70+ if (str_contains ($ entry , '= ' )) {
71+ $ split = explode ('= ' , $ entry );
72+ $ opts [trim ($ split [0 ], " \t\n\r\0\x0B- " )] = trim ($ split [1 ]);
73+ } else if ($ len > ($ i + 1 ) && !str_starts_with ($ inArgs [$ i + 1 ], '- ' )) {
74+ $ val = '' ;
75+
76+ while ($ len > ($ i + 1 ) && !str_starts_with ($ inArgs [$ i + 1 ], '- ' )) {
77+ $ val .= $ inArgs [$ i + 1 ] . ' ' ;
78+ $ i ++;
79+ }
80+
81+ $ opts [trim ($ entry , " \t\n\r\0\x0B- " )] = trim ($ val , " \t\n\r\0\x0B\"" );
82+ } else {
83+ $ opts [trim ($ entry , " \t\n\r\0\x0B- " )] = null ;
84+ }
8585 }
8686
8787 self ::$ parsed = ['command ' => $ command , 'arguments ' => $ args , 'options ' => $ opts ];
0 commit comments