Skip to content

Commit 5d56dc7

Browse files
author
Sebastian Feldmann
committed
Fix arg formatting
1 parent a21b8b7 commit 5d56dc7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Artisan.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,15 @@ private function setup(Config\Options $options)
9999
}
100100
}
101101

102+
102103
/**
103104
* Put command and arguments in an array
104105
*
105106
* @return array
106107
*/
107-
private function getArgs()
108+
private function getArgs(): array
108109
{
109-
return array_filter(
110-
array_merge([$this->command], $this->optionArgsAsArray()),
111-
function($arg) {
112-
return !empty($arg);
113-
}
114-
);
110+
return array_merge([$this->command], $this->optionArgsAsArray());
115111
}
116112

117113
/**
@@ -124,7 +120,15 @@ private function optionArgsAsArray(): array
124120
if (empty($this->args)) {
125121
return [];
126122
}
127-
return explode(' ', $this->args);
123+
$args = [];
124+
foreach (explode(' ', $this->args) as $param) {
125+
$value = true;
126+
if (strpos($param, '=') !== false) {
127+
list($param, $value) = explode('=', $param);
128+
}
129+
$args[$param] = $value;
130+
}
131+
return $args;
128132
}
129133

130134
/**

0 commit comments

Comments
 (0)