Bundle/WidgetBundle/Command/CreateWidgetCommand.php
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
private function parseFields ( $ input ) { if ( is_array ( $ input ) ) { return $ input ; } $ fields = [ ] ; foreach ( explode ( ' ' , $ input ) as $ value ) { $ elements = explode ( ':' , $ value ) ; $ name = $ elements [ 0 ] ; if ( strlen ( $ name ) ) { $ type = isset ( $ elements [ 1 ] ) ? $ elements [ 1 ] : 'string' ; preg_match_all ( '/(.*)\((.*)\)/' , $ type , $ matches ) ; $ type = isset ( $ matches [ 1 ] [ 0 ] ) ? $ matches [ 1 ] [ 0 ] : $ type ; $ length = isset ( $ matches [ 2 ] [ 0 ] ) ? $ matches [ 2 ] [ 0 ] : null ; $ fields [ $ name ] = [ 'fieldName' => $ name , 'type' => $ type , 'length' => $ length ] ; } } return $ fields ; }
transform console's output string fields into an array of fields.

@param string $input

@return array $fields
transform console s output string fields into an array of fields .