public function to($type)
    {
        switch ($type) {
            case 'ini':
                $this->string = Ini::encode($this->data);
                break;

            case 'json':
                $this->string = Json::encode($this->data, $this->prettyOutput);
                break;

            case 'php':
                $this->string = Php::encode($this->data);
                break;

            case 'xml':
                $this->string = Xml::encode($this->data, $this->prettyOutput);
                break;

            case 'yml':
            case 'yaml':
                $this->string = Yaml::encode($this->data);
                break;
            
            default:
                throw new \Exception("Format not supported: " . $type);
        }

        return $this->string;
    }
public function to($type)
    {
        switch ($type) {
            case 'ini':
                $this->string = Ini::encode($this->data);
                break;

            case 'json':
                $this->string = Json::encode($this->data, $this->prettyOutput);
                break;

            case 'php':
                $this->string = Php::encode($this->data);
                break;

            case 'xml':
                $this->string = Xml::encode($this->data, $this->prettyOutput);
                break;

            case 'yml':
            case 'yaml':
                $this->string = Yaml::encode($this->data);
                break;
            
            default:
                throw new \Exception("Format not supported: " . $type);
        }

        return $this->string;
    }
public function to ( $ type ) { switch ( $ type ) { case 'ini' : $ this -> string = Ini :: encode ( $ this -> data ) ; break ; case 'json' : $ this -> string = Json :: encode ( $ this -> data , $ this -> prettyOutput ) ; break ; case 'php' : $ this -> string = Php :: encode ( $ this -> data ) ; break ; case 'xml' : $ this -> string = Xml :: encode ( $ this -> data , $ this -> prettyOutput ) ; break ; case 'yml' : case 'yaml' : $ this -> string = Yaml :: encode ( $ this -> data ) ; break ; default : throw new \ Exception ( "Format not supported: " . $ type ) ; } return $ this -> string ; }
Specifies the format you want to encode the data to
@param  string $type Type [ini, json, php, xml or yaml]
@return string
Specifies the format you want to encode the data to