private function write(array $compiled): void
    {
        $tmp = tempnam(sys_get_temp_dir(), 'quanta');

        if ($tmp !== false) {
            file_put_contents($tmp, vsprintf('<?php%s%sreturn %s;%s', [
                PHP_EOL,
                PHP_EOL,
                Utils::ArrayStr($compiled ?? []),
                PHP_EOL,
            ]));

            rename($tmp, $this->path);
        }
    }
private function write(array $compiled): void
    {
        $tmp = tempnam(sys_get_temp_dir(), 'quanta');

        if ($tmp !== false) {
            file_put_contents($tmp, vsprintf('<?php%s%sreturn %s;%s', [
                PHP_EOL,
                PHP_EOL,
                Utils::ArrayStr($compiled ?? []),
                PHP_EOL,
            ]));

            rename($tmp, $this->path);
        }
    }
private function write ( array $ compiled ) : void { $ tmp = tempnam ( sys_get_temp_dir ( ) , 'quanta' ) ; if ( $ tmp !== false ) { file_put_contents ( $ tmp , vsprintf ( '<?php%s%sreturn %s;%s' , [ PHP_EOL , PHP_EOL , Utils :: ArrayStr ( $ compiled ?? [ ] ) , PHP_EOL , ] ) ) ; rename ( $ tmp , $ this -> path ) ; } }
Write the given compiled factories array to a unique temporary file and
move it to the compiled file path.

Is this safe ?

@param string[] $compiled
@return void
Write the given compiled factories array to a unique temporary file and move it to the compiled file path .