public function fields($fields, $path = null)
    {
        if (is_null($fields)) return;

        $path = $path ?: __DIR__.'/../tmp-fields.txt';
        $fields = preg_split('/, ?/', $fields);
        $arrayFields = array();

        foreach($fields as $pair)
        {
            list($key, $val) = preg_split('/ ?: ?/', $pair);
            $arrayFields[$key] = $val;
        }

        return $this->file->put($path, json_encode($arrayFields));
    }
public function fields($fields, $path = null)
    {
        if (is_null($fields)) return;

        $path = $path ?: __DIR__.'/../tmp-fields.txt';
        $fields = preg_split('/, ?/', $fields);
        $arrayFields = array();

        foreach($fields as $pair)
        {
            list($key, $val) = preg_split('/ ?: ?/', $pair);
            $arrayFields[$key] = $val;
        }

        return $this->file->put($path, json_encode($arrayFields));
    }
public function fields ( $ fields , $ path = null ) { if ( is_null ( $ fields ) ) return ; $ path = $ path ? : __DIR__ . '/../tmp-fields.txt' ; $ fields = preg_split ( '/, ?/' , $ fields ) ; $ arrayFields = array ( ) ; foreach ( $ fields as $ pair ) { list ( $ key , $ val ) = preg_split ( '/ ?: ?/' , $ pair ) ; $ arrayFields [ $ key ] = $ val ; } return $ this -> file -> put ( $ path , json_encode ( $ arrayFields ) ) ; }
Save fields to cached file
for future use by other commands

@param string $fields
@param string $path
@return mixed
Save fields to cached file for future use by other commands