src/Dev/Install/Installer.php
public function writeToFile($filename, $content, $absolute = false)
    {
        // Get absolute / relative paths by either combining or removing base from path
        list($absolutePath, $relativePath) = $absolute
            ? [
                $filename,
                substr($filename, strlen($this->getBaseDir()))]
            : [
                $this->getBaseDir() . $filename,
                $filename
            ];
        $this->statusMessage("Setting up $relativePath");

        if ((@$fh = fopen($absolutePath, 'wb')) && fwrite($fh, $content) && fclose($fh)) {
            // Set permissions to writable
            @chmod($absolutePath, 0775);
            return true;
        }
        $this->error("Couldn't write to file $relativePath");
        return false;
    }
public function writeToFile($filename, $content, $absolute = false)
    {
        // Get absolute / relative paths by either combining or removing base from path
        list($absolutePath, $relativePath) = $absolute
            ? [
                $filename,
                substr($filename, strlen($this->getBaseDir()))]
            : [
                $this->getBaseDir() . $filename,
                $filename
            ];
        $this->statusMessage("Setting up $relativePath");

        if ((@$fh = fopen($absolutePath, 'wb')) && fwrite($fh, $content) && fclose($fh)) {
            // Set permissions to writable
            @chmod($absolutePath, 0775);
            return true;
        }
        $this->error("Couldn't write to file $relativePath");
        return false;
    }
public function writeToFile ( $ filename , $ content , $ absolute = false ) { // Get absolute / relative paths by either combining or removing base from path list ( $ absolutePath , $ relativePath ) = $ absolute ? [ $ filename , substr ( $ filename , strlen ( $ this -> getBaseDir ( ) ) ) ] : [ $ this -> getBaseDir ( ) . $ filename , $ filename ] ; $ this -> statusMessage ( "Setting up $relativePath" ) ; if ( ( @ $ fh = fopen ( $ absolutePath , 'wb' ) ) && fwrite ( $ fh , $ content ) && fclose ( $ fh ) ) { // Set permissions to writable @ chmod ( $ absolutePath , 0775 ) ; return true ; } $ this -> error ( "Couldn't write to file $relativePath" ) ; return false ; }
Write file to given location

@param string $filename
@param string $content
@param bool $absolute If $filename is absolute path set to true
@return bool
Write file to given location