src/phpGPX/Models/GpxFile.php
public function save($path, $format)
	{
		switch ($format) {
			case phpGPX::XML_FORMAT:
				$document = $this->toXML();
				$document->save($path);
				break;
			case phpGPX::JSON_FORMAT:
				file_put_contents($path, $this->toJSON());
				break;
			default:
				throw new \RuntimeException("Unsupported file format!");
		};
	}
public function save($path, $format)
	{
		switch ($format) {
			case phpGPX::XML_FORMAT:
				$document = $this->toXML();
				$document->save($path);
				break;
			case phpGPX::JSON_FORMAT:
				file_put_contents($path, $this->toJSON());
				break;
			default:
				throw new \RuntimeException("Unsupported file format!");
		};
	}
public function save ( $ path , $ format ) { switch ( $ format ) { case phpGPX :: XML_FORMAT : $ document = $ this -> toXML ( ) ; $ document -> save ( $ path ) ; break ; case phpGPX :: JSON_FORMAT : file_put_contents ( $ path , $ this -> toJSON ( ) ) ; break ; default : throw new \ RuntimeException ( "Unsupported file format!" ) ; } ; }
Save data to file according to selected format.
@param string $path
@param string $format
Save data to file according to selected format .