nginx_conf = $nginx_conf; $this->filesystem = $filesystem; $this->logger = $logger; } /** * Atomically write content to the swpsp-nginx.conf file. * * @param string $content The content to save to the swpsp-nginx.conf file. * * @return bool */ public function write( string $content ): bool { try { $filepath = $this->nginx_conf->get_file_path(); $this->filesystem->write( $filepath, $content ); } catch ( RuntimeException $e ) { $this->logger->error( 'Unable to write content to swpsp-nginx.conf file', [ 'exception' => $e, ] ); return false; } return true; } }