src/Assets/Asset.php
public function writeToFile($filePath)
    {
        $out = @fopen($filePath,"w");

        if (!$out){
            throw new AssetException($this->token,
                "The asset '".$this->token."' could not be written to path '$filePath'. Check the path is valid and the directory exists.");
        }

        $stream = $this->getStream();

        if (!$stream){
            throw new AssetException($this->token,
                "The asset '".$this->token."' could not provide a valid stream.'");
        }

        while(!feof($stream)){
            $bytes = fread($stream, 8192);
            fwrite($out, $bytes);
        }

        fclose($stream);
        fclose($out);
    }
public function writeToFile($filePath)
    {
        $out = @fopen($filePath,"w");

        if (!$out){
            throw new AssetException($this->token,
                "The asset '".$this->token."' could not be written to path '$filePath'. Check the path is valid and the directory exists.");
        }

        $stream = $this->getStream();

        if (!$stream){
            throw new AssetException($this->token,
                "The asset '".$this->token."' could not provide a valid stream.'");
        }

        while(!feof($stream)){
            $bytes = fread($stream, 8192);
            fwrite($out, $bytes);
        }

        fclose($stream);
        fclose($out);
    }
public function writeToFile ( $ filePath ) { $ out = @ fopen ( $ filePath , "w" ) ; if ( ! $ out ) { throw new AssetException ( $ this -> token , "The asset '" . $ this -> token . "' could not be written to path '$filePath'. Check the path is valid and the directory exists." ) ; } $ stream = $ this -> getStream ( ) ; if ( ! $ stream ) { throw new AssetException ( $ this -> token , "The asset '" . $ this -> token . "' could not provide a valid stream.'" ) ; } while ( ! feof ( $ stream ) ) { $ bytes = fread ( $ stream , 8192 ) ; fwrite ( $ out , $ bytes ) ; } fclose ( $ stream ) ; fclose ( $ out ) ; }
Write the asset out to the corresponding file path.

@param $filePath
@throws AssetException
Write the asset out to the corresponding file path .