src/AutogeneratedFile.php
public function export(string $path) : File
    {
        $target_dir = new File($path);
        
        if (!$target_dir->exists()){
            throw new DecoyException('Export target directory not exists:' . $path);
        }
        if (!$target_dir->canWrite()){
            throw new DecoyException('Export target directory not writable:' . $path);
        }
        
        $file = new File($this->autogenerated_file->getName(), $target_dir);
        $parent_dir = $file->getParent();
        
        try{
            $parent_dir->makeDirectory();
        }
        catch(MakeDirectoryException $e){
            throw new DecoyException('Making parent directory failed:' . $parent_dir, $e);
        }
        
        try{
            $file->putContents($this->autogenerated_file->getContent());
        }
        catch(FileOutputException $e){
            throw new DecoyException('Writing output file failed:' . $file);
        }
        
        return $file;
    }
public function export(string $path) : File
    {
        $target_dir = new File($path);
        
        if (!$target_dir->exists()){
            throw new DecoyException('Export target directory not exists:' . $path);
        }
        if (!$target_dir->canWrite()){
            throw new DecoyException('Export target directory not writable:' . $path);
        }
        
        $file = new File($this->autogenerated_file->getName(), $target_dir);
        $parent_dir = $file->getParent();
        
        try{
            $parent_dir->makeDirectory();
        }
        catch(MakeDirectoryException $e){
            throw new DecoyException('Making parent directory failed:' . $parent_dir, $e);
        }
        
        try{
            $file->putContents($this->autogenerated_file->getContent());
        }
        catch(FileOutputException $e){
            throw new DecoyException('Writing output file failed:' . $file);
        }
        
        return $file;
    }
public function export ( string $ path ) : File { $ target_dir = new File ( $ path ) ; if ( ! $ target_dir -> exists ( ) ) { throw new DecoyException ( 'Export target directory not exists:' . $ path ) ; } if ( ! $ target_dir -> canWrite ( ) ) { throw new DecoyException ( 'Export target directory not writable:' . $ path ) ; } $ file = new File ( $ this -> autogenerated_file -> getName ( ) , $ target_dir ) ; $ parent_dir = $ file -> getParent ( ) ; try { $ parent_dir -> makeDirectory ( ) ; } catch ( MakeDirectoryException $ e ) { throw new DecoyException ( 'Making parent directory failed:' . $ parent_dir , $ e ) ; } try { $ file -> putContents ( $ this -> autogenerated_file -> getContent ( ) ) ; } catch ( FileOutputException $ e ) { throw new DecoyException ( 'Writing output file failed:' . $ file ) ; } return $ file ; }
Export to local file

@param string $path

@return File

@throws DecoyException
Export to local file