5 * Contains Drupal\Console\Core\Command\Shared\InputTrait.
8 namespace Drupal\Console\Core\Command\Shared;
13 * @package Drupal\Console\Core\Command\Shared
20 private function inlineValueAsArray($inputValue)
23 foreach ($inputValue as $key => $value) {
24 if (!is_array($value)) {
26 $inputAsArray[] = json_decode('[{'.$value.'}]', true)[0];
27 } catch (\Exception $e) {
33 return $inputAsArray?$inputAsArray:$inputValue;
39 private function placeHolderInlineValueAsArray($inputValue)
41 $inputArrayValue = [];
42 foreach ($inputValue as $key => $value) {
43 if (!is_array($value)) {
44 $separatorIndex = strpos($value, ':');
45 if (!$separatorIndex) {
48 $inputKeyItem = substr($value, 0, $separatorIndex);
49 $inputValueItem = substr($value, $separatorIndex+1);
50 $inputArrayValue[$inputKeyItem] = $inputValueItem;
54 return $inputArrayValue?$inputArrayValue:$inputValue;