/**
* Class InputTrait
*
- * @package Drupal\Console\Core\Command
+ * @package Drupal\Console\Core\Command\Shared
*/
trait InputTrait
{
* @return array
*/
private function inlineValueAsArray($inputValue)
+ {
+ $inputAsArray = [];
+ foreach ($inputValue as $key => $value) {
+ if (!is_array($value)) {
+ try {
+ $inputAsArray[] = json_decode('[{'.$value.'}]', true)[0];
+ } catch (\Exception $e) {
+ continue;
+ }
+ }
+ }
+
+ return $inputAsArray?$inputAsArray:$inputValue;
+ }
+
+ /**
+ * @return array
+ */
+ private function placeHolderInlineValueAsArray($inputValue)
{
$inputArrayValue = [];
foreach ($inputValue as $key => $value) {
}
$inputKeyItem = substr($value, 0, $separatorIndex);
$inputValueItem = substr($value, $separatorIndex+1);
- $inputArrayValue[$key] = [$inputKeyItem => $inputValueItem];
+ $inputArrayValue[$inputKeyItem] = $inputValueItem;
}
}