private function writeFile(string $filename, string $content)
    {
        $directory = \dirname($filename);
        if (!\is_writable($directory)) {
            throw new \RuntimeException(\sprintf('Cache directory "%s" is not writable.', $directory));
        }

        $tmpFile = \tempnam($directory, \basename($filename));

        if (false === @\file_put_contents($tmpFile, $content)) {
            throw new \RuntimeException(\sprintf('Could not write file "%s".', $tmpFile));
        }
        if (!@\rename($tmpFile, $filename)) {
            throw new \RuntimeException(\sprintf('Could not write file "%s".', $filename));
        }
        @\chmod($filename, 0666 & ~\umask());
    }
private function writeFile(string $filename, string $content)
    {
        $directory = \dirname($filename);
        if (!\is_writable($directory)) {
            throw new \RuntimeException(\sprintf('Cache directory "%s" is not writable.', $directory));
        }

        $tmpFile = \tempnam($directory, \basename($filename));

        if (false === @\file_put_contents($tmpFile, $content)) {
            throw new \RuntimeException(\sprintf('Could not write file "%s".', $tmpFile));
        }
        if (!@\rename($tmpFile, $filename)) {
            throw new \RuntimeException(\sprintf('Could not write file "%s".', $filename));
        }
        @\chmod($filename, 0666 & ~\umask());
    }
private function writeFile ( string $ filename , string $ content ) { $ directory = \ dirname ( $ filename ) ; if ( ! \ is_writable ( $ directory ) ) { throw new \ RuntimeException ( \ sprintf ( 'Cache directory "%s" is not writable.' , $ directory ) ) ; } $ tmpFile = \ tempnam ( $ directory , \ basename ( $ filename ) ) ; if ( false === @ \ file_put_contents ( $ tmpFile , $ content ) ) { throw new \ RuntimeException ( \ sprintf ( 'Could not write file "%s".' , $ tmpFile ) ) ; } if ( ! @ \ rename ( $ tmpFile , $ filename ) ) { throw new \ RuntimeException ( \ sprintf ( 'Could not write file "%s".' , $ filename ) ) ; } @ \ chmod ( $ filename , 0666 & ~ \ umask ( ) ) ; }
Write PHP file

@param string $filename
@param string $content
Write PHP file