Skip to content

Commit 7860068

Browse files
committed
update some for flags parse
1 parent 86d9b44 commit 7860068

File tree

2 files changed

+15
-36
lines changed

2 files changed

+15
-36
lines changed

Diff for: .github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
# Check for updates to GitHub Actions every weekday
13+
interval: "daily"

Diff for: src/Flags.php

+2-36
Original file line numberDiff line numberDiff line change
@@ -31,41 +31,6 @@
3131
*/
3232
class Flags
3333
{
34-
/**
35-
* @param array $argv
36-
*
37-
* @return array [$args, $opts]
38-
*/
39-
public static function simpleParseArgv(array $argv): array
40-
{
41-
$args = $opts = [];
42-
foreach ($argv as $value) {
43-
// opts
44-
if (strpos($value, '-') === 0) {
45-
$value = trim($value, '-');
46-
47-
// invalid
48-
if (!$value) {
49-
continue;
50-
}
51-
52-
if (strpos($value, '=')) {
53-
[$n, $v] = explode('=', $value);
54-
$opts[$n] = $v;
55-
} else {
56-
$opts[$value] = true;
57-
}
58-
} elseif (strpos($value, '=')) {
59-
[$n, $v] = explode('=', $value);
60-
$args[$n] = $v;
61-
} else {
62-
$args[] = $value;
63-
}
64-
}
65-
66-
return [$args, $opts];
67-
}
68-
6934
/**
7035
* Parses $GLOBALS['argv'] for parameters and assigns them to an array.
7136
* eg:
@@ -304,11 +269,12 @@ public static function parseString(string $string, array $config = []): array
304269
}
305270

306271
/**
307-
* Escapes a token through escapeshellarg if it contains unsafe chars.
272+
* Escapes a token through escape shell arg if it contains unsafe chars.
308273
*
309274
* @param string $token
310275
*
311276
* @return string
277+
* @deprecated please use FlagHelper::escapeToken
312278
*/
313279
public static function escapeToken(string $token): string
314280
{

0 commit comments

Comments
 (0)