H2P\Converter\ConverterAbstract::convert PHP Method

convert() public method

Convert the file, passing the right arguments to the Converter::transform (proxy pattern)
public convert ( string | H2P\Request | H2P\TempFile $origin, string | H2P\TempFile $destination )
$origin string | H2P\Request | H2P\TempFile
$destination string | H2P\TempFile
    public function convert($origin, $destination)
    {
        if (!$origin instanceof Request) {
            if ($origin instanceof TempFile) {
                $origin = 'file://' . $origin->getFileName();
            }
            // Create a simple GET request URI
            $request = new Request($origin);
        } else {
            $request = $origin;
        }
        if ($destination instanceof TempFile) {
            $destination = $destination->getFileName();
        }
        if (!@fopen($destination, 'a')) {
            throw new Exception('The destination file is not writable!');
        }
        $this->transform($request, $destination);
    }