Write a given content to a given file path

@param string $filePath Path to the class file
@param string $content  Content of the class file

@throws \Exception
557210
protected function writeFile($filePath, $content)
    {
        $this->validateOutputDirectoryPermissions();

        $currentDirectory = dirname($filePath);
        if (!is_writable($currentDirectory)) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\PermissionException(
                'Could not create file ' . $filePath . ' ' .
                'The directory ' . $currentDirectory . ' is not writable for user "' . get_current_user() . '". ' .
                'Please fix the permissions on this directory and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $fileHandle = fopen($filePath, 'wb');
        if (!$fileHandle) {
            throw new \OxidEsales\UnifiedNameSpaceGenerator\Exceptions\FileSystemCompatibilityException(
                'Could not open file file handle for ' . $filePath . ' ' .
                'There might be a problem with your file system. Try to solve this problem and run this script again.',
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }

        $result = fwrite($fileHandle, $content);
        if (false === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Could not create file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        if (0 === $result) {
            fclose($fileHandle);
            throw new \Exception(
                'Created empty file ' . $filePath,
                static::ERROR_CODE_FILE_CREATION_ERROR
            );
        }
        fclose($fileHandle);
    }
905382
protected function _save($content) {
        if (!file_put_contents($this->_getIncludesFilename(), $content)) {
            throw new Exception(sprintf(self::EXCEPTION_WRITE_ERROR));
        }
        return true;
    }
993681
def write_file(file_path, content):
    
    handler = open(file_path, 'w+')
    handler.write(content)
    handler.close()
488425
public static boolean writeString(String filePath, String content, boolean append) throws IOException {
        return writeString(filePath != null ? new File(filePath) : null, content, append);
    }
797325
private function write($src, $fileName, $content)
    {

        if (!$this->file->exists($src)) {
            $this->file->makeDirectory($src);
        }
        $this->file->put($fileName, $content);
    }
1182394
public static function sendFile( $filePath ){
      $config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
      if ( $config->getXSendfile() ){
        CKFinder_Connector_Utils_FileSystem::sendWithXSendfile($filePath);
      } else {
        CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
      }
    }
995398
public function writeCompressedFile($compressedFilepath, $filepath)
	{
		$filePointer = fopen($compressedFilepath, 'w');
		fwrite($filePointer, gzencode(file_get_contents($filepath), 9));
		fclose($filePointer);
	}
281653
protected void writeFile(String subdir, String filename, String content) throws IOException {
        Path dir = root;
        if (subdir != null) {
            dir = dir.resolve(subdir);

            // If the dir does not exist, we need to create it
            if (Files.notExists(dir)) {
                Files.createDirectory(dir);
            }
        }
        Files.write(dir.resolve(filename), content.getBytes(StandardCharsets.UTF_8));
    }
477508
public static function appendToFile(string $filePath, string $content, bool $withoutDuplicates = true): void
	{
		if ($withoutDuplicates && self::fileContains($filePath, $content)) {
			return;
		}

		self::insertIntoFile($filePath, $content, FILE_APPEND);
	}
372996
public function getFileContent($filePath)
    {
        if ($this->repository->fileExists($filePath) === false) {
            throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
        }
        return $this->repository->getFileContent($filePath);
    }
573101
public function write($content = '')
    {
        if ($this->rotate()) {
            if (empty($this->file_mtime) && file_exists($this->file_path)) {
                $this->file_mtime = filemtime($this->file_path);
            }
            $f = @fopen($this->file_path, "ab");
            if ($f) {
                fputs($f, str_replace('<', '&lt;', $content));
                fclose($f);
                $this->file_mtime = filemtime($this->file_path);
                return true;
            } else {
                throw new \RuntimeException(
                    sprintf('Can not write in file "%s"!', $this->file_path)
                );
            }
        } else {
            throw new \RuntimeException(
                sprintf('Can not write and/or rotate file "%s"!', $this->file_path)
            );
        }
    }
816556
public function writeFile(
        string $content,
        string $filename,
        string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING,
        ?ErrorCorrectionLevel $ecLevel = null
    ) : void {
        file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel));
    }
263983
public function editNodeContent( $nodePath, $content )
	{
		$node	= $this->getNode( $nodePath );
		if( $node->setContent( $content ) )
			return (bool) $this->write();
		return FALSE;
	}
1086256
public function writeUncompressedFile($uncompressedFilepath, $filepath)
	{
		$filePointer = fopen($uncompressedFilepath, 'w');
		fwrite($filePointer, gzdecode(file_get_contents($filepath, 9)));
		fclose($filePointer);
	}
1167498
protected function createFile($filePath, $contents)
    {
        $this->createDirectory(dirname($filePath));
        
        if (is_file($filePath)) {
            // if (!$this->opt('force')) {
            $this->output->setDecorated(true);
            $this->output->writeln(sprintf(
                "<comment>file exists  <cyan>%s</cyan></comment>",
                $this->prettyPath($filePath)
            ));
                // return;
            // } else {
                // $this->output->writeln(sprintf(
                    // "<comment>overwriten  <cyan>%s</cyan></comment>",
                    // $filePath
                // ));
            // }
        } else {
            $this->output->writeln(sprintf(
                "<info>create  <cyan>%s</cyan></info>",
                $this->prettyPath($filePath)
            ));
            file_put_contents($filePath, $contents);
        }
        
    }
656932
function save(filePath, content) {
    mkpath(PATH.dirname(filePath));
    fs.writeFileSync(filePath, content);
}
419601
public function writeFile($filePath, array $translations)
    {
        $content = "<?php \n\nreturn [";

        $content .= $this->stringLineMaker($translations);

        $content .= "\n];";

        file_put_contents($filePath, $content);
    }