protected function convertFieldsToArray()
    {
        $fields = $this->fields;

        if ( !$fields ) return;

        $fields = preg_split('/, */', $fields);

        foreach($fields as &$bit)
        {
            $columnInfo = preg_split('/ *: */', $bit);

            $bit = new \StdClass;
            $bit->name = array_shift($columnInfo);
            $bit->type = array_shift($columnInfo);

            // If there is a third key, then
            // the user is setting any number
            // of options
            if ( isset($columnInfo[0]) )
            {
                $bit->options = '';
                foreach($columnInfo as $option)
                {
                    $bit->options .= (str_contains($option, '('))
                        ? "->{$option}"
                        : "->{$option}()";
                }
            }
        }

        return $fields;
    }
protected function convertFieldsToArray()
    {
        $fields = $this->fields;

        if ( !$fields ) return;

        $fields = preg_split('/, */', $fields);

        foreach($fields as &$bit)
        {
            $columnInfo = preg_split('/ *: */', $bit);

            $bit = new \StdClass;
            $bit->name = array_shift($columnInfo);
            $bit->type = array_shift($columnInfo);

            // If there is a third key, then
            // the user is setting any number
            // of options
            if ( isset($columnInfo[0]) )
            {
                $bit->options = '';
                foreach($columnInfo as $option)
                {
                    $bit->options .= (str_contains($option, '('))
                        ? "->{$option}"
                        : "->{$option}()";
                }
            }
        }

        return $fields;
    }
protected function convertFieldsToArray ( ) { $ fields = $ this -> fields ; if ( ! $ fields ) return ; $ fields = preg_split ( '/, */' , $ fields ) ; foreach ( $ fields as & $ bit ) { $ columnInfo = preg_split ( '/ *: */' , $ bit ) ; $ bit = new \ StdClass ; $ bit -> name = array_shift ( $ columnInfo ) ; $ bit -> type = array_shift ( $ columnInfo ) ; // If there is a third key, then // the user is setting any number // of options if ( isset ( $ columnInfo [ 0 ] ) ) { $ bit -> options = '' ; foreach ( $ columnInfo as $ option ) { $ bit -> options .= ( str_contains ( $ option , '(' ) ) ? "->{$option}" : "->{$option}()" ; } } } return $ fields ; }
If Schema fields are specified, parse
them into an array of objects.

So: name:string, age:integer
Becomes: [ ((object)['name' => 'string'], (object)['age' => 'integer'] ]

@returns mixed
If Schema fields are specified parse them into an array of objects .