abe8aa0ad4dbeb51f8c9ce8bd4bf4461b34a980c
[yaffs-website] / vendor / drupal / console-core / src / Command / Shared / InputTrait.php
1 <?php
2
3 /**
4  * @file
5  * Contains Drupal\Console\Core\Command\Shared\InputTrait.
6  */
7
8 namespace Drupal\Console\Core\Command\Shared;
9
10 /**
11  * Class InputTrait
12  * @package Drupal\Console\Core\Command
13  */
14 trait InputTrait
15 {
16     /**
17      * @return array
18      */
19     private function inlineValueAsArray($inputValue)
20     {
21         $inputArrayValue = [];
22         foreach ($inputValue as $key => $value) {
23             if (!is_array($value)) {
24                 $separatorIndex = strpos($value, ':');
25                 if (!$separatorIndex) {
26                     continue;
27                 }
28                 $inputKeyItem = substr($value, 0, $separatorIndex);
29                 $inputValueItem = substr($value, $separatorIndex+1);
30                 $inputArrayValue[$key] = [$inputKeyItem => $inputValueItem];
31             }
32         }
33
34         return $inputArrayValue?$inputArrayValue:$inputValue;
35     }
36 }