Writes sectioned Property File and returns Number of written Bytes.
@access		public
@return		int
18392
public function write()
	{
		$lines		= array();
		$sections	= $this->getSections();
		foreach( $sections as $section )
		{
			$lines[]	= "[".$section."]";
			foreach( $this->data[$section] as $key => $value )
				$lines[]	= $this->fillUp( $key )."=".$value;
		}
		return FS_File_Writer::saveArray( $this->fileName, $lines );
		$this->read();
	}
1028585
public function onWriteReady()
    {
        $bytesWritten = fwrite($this->socket, $this->outputBuffer);

        /*
         * Fragment below looks weird at first, but it's perfectly logical.
         * Most of the time buffer is completely written by fwrite() into system TCP buffer (which is 8KB by default). In
         * that case using (rather expansive) substr() call can be avoided by checking whatever buffer was completely
         * written. To do so efficiently isset() and direct character access is used. fwrite() returns NUMBER OF BYTES
         * written. Character in strings are indexed from 0 (like arrays), so calling fwrite($socket, "abcde") return
         * 5 if it was fully written, calling isset($x[5]) produce "false" because last character have index of 4.
         */
        $this->outputBuffer = (!isset($this->outputBuffer[$bytesWritten])) ? '' : substr($this->outputBuffer,
            $bytesWritten);

        //$this->logger->debug("Sent $bytesWritten to client $this");
        //$this->logger->debug("Client $this contains " . strlen($this->outputBuffer) . ' bytes in write buffer'); //Time consuming

        return ($this->outputBuffer === '');
    }
1207143
private function _writeMarginLeft()
	{
		$record  = 0x0026;				   // Record identifier
		$length  = 0x0008;				   // Bytes to follow

		$margin  = $this->_phpSheet->getPageMargins()->getLeft();	 // Margin in inches

		$header	= pack("vv",  $record, $length);
		$data	  = pack("d",   $margin);
		if (self::getByteOrder()) { // if it's Big Endian
			$data = strrev($data);
		}

		$this->_append($header . $data);
	}
661021
public function write()
    {
        $filename = $this->isFileWritable() ? $this->filename : $this->getCacheFilename();

        return file_put_contents($filename, $this->render());
    }
1025788
public function write()
    {
        $stats = array('hits' => $this->hits, 'misses' => $this->misses);

        file_put_contents($this->getFilename(), serialize($stats));
    }
483487
public function write(string $data): int
    {
        $length = strlen($data);

        if (0 === $length) {
            return 0;
        }

        $written = @fwrite($this->handle, $data, $length);

        if (false === $written || $written !== $length) {
            $message = 'Could not write to the file.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return $written;
    }
974835
public function write()
	{
		$writer	= new XML_DOM_FileWriter( $this->fileName );
		$root	= new XML_DOM_Node( $this->getOption( 'tag_root' ) );
		$this->writeRecursive( $root, $this->storage );
		return $writer->write( $root );
	}
1009064
public function writeIfNotExists(): string
    {
        if ($this->targetFile->exists()) {
            return $this->targetFile->getPath();
        }

        return $this->write();
    }
507772
function _write($data)
    {
        if ($this->_hashedDirectoryLevel > 0) {
            $hash = md5($this->_fileName);
            $root = $this->_cacheDir;
            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
                if (!(@is_dir($root))) {
					if (@mkdir($root))
					{
						@chmod($root, $this->_hashedDirectoryUmask);
						if (! is_null($this->_hashedDirectoryGroup))
							@chgrp($root, $this->_hashedDirectoryGroup);
					}
                }
            }
        }
		// if both _cacheFileMode and _cacheFileGroup is null, then we don't need to call
		// file_exists (see below: if ($is_newfile) ...)
		$is_newfile = (! is_null($this->_cacheFileMode) || !is_null($this->_cacheFileGroup)) 
			&& ! @file_exists($this->_file);
        $fp = @fopen($this->_file, "wb");
        if ($fp) {
            if ($this->_fileLocking) @flock($fp, LOCK_EX);
			if ($is_newfile)
			{
				if (! is_null($this->_cacheFileMode))
					@chmod($this->_file, $this->_cacheFileMode);
				if (! is_null($this->_cacheFileGroup))
					@chgrp($this->_file, $this->_cacheFileGroup);
			}
            if ($this->_readControl) {
                @fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
            }
            $mqr = get_magic_quotes_runtime();
            if ($mqr) {
                set_magic_quotes_runtime(0);
            }
            @fwrite($fp, $data);
            if ($mqr) {
                set_magic_quotes_runtime($mqr);
            }
            if ($this->_fileLocking) @flock($fp, LOCK_UN);
            @fclose($fp);
            return true;
        }      
        return $this->raiseError('Cache_Lite : Unable to write cache file : '.$this->_file, -1);
    }
1202457
public function count(): int
    {
        if ($this->count == null) {
            $this->count = 0;

            if ($handle = opendir($this->fileInfo->getAbsoluteFilePath())) {
                while (($file = readdir($handle)) !== false) {
                    if (!in_array($file, array('.', '..'))) {
                        $this->count++;
                    }
                }

                closedir($handle);
            }
        }

        return $this->count;
    }
1041494
public function stream_write($data)
    {
        if ($this->fileHandle === null) {
            return false;
        }
        self::restore();
        $length = fwrite($this->fileHandle, $data);
        self::register();
        return $length;
    }
453084
private function logWriteFile()
    {
        $cfg = $this->form->cfg;
        $file = $cfg['logFile'];
        $keys = \array_column($this->columns, 'key');
        $values = \array_column($this->columns, 'values');
        $appendFile = false;
        $keyCounts = array();       // for indexing keys of same name
        foreach ($keys as $k => $key) {
            $key = \trim(\strtolower($key));
            if (!isset($keyCounts[$key])) {
                $keyCounts[$key] = 1;
            } else {
                $keyCounts[$key]++;
                $key .= ' '.$keyCounts[$key];
            }
            $keys[$k] = $key;
        }
        if (\file_exists($file)) {
            $this->debug->log('log exists');
            // check that the keys in file match the data we're writing
            $handle = \fopen($file, 'rb');
            $keysExisting = \fgetcsv($handle, 4096, $cfg['logDelimitter']);
            \fclose($handle);
            if ($keysExisting === $keys) {
                $appendFile = true;
            }
        } else {
            $this->debug->log($file.' does not exist');
        }
        if ($appendFile) {
            $appendString = ArrayUtil::implodeDelim($values, $cfg['logDelimitter']);
            $return = FileIo::safeFileAppend($file, $appendString);
        } else {
            $rows = FileIo::readDelimFile($file);
            $rows[] = \array_combine($keys, $values);
            $return = FileIo::writeDelimFile($file, $rows, array(
                'char' => $cfg['log_delimitter']
            ));
        }
        return $return;
    }
747305
protected function getKeysToWrite()
    {
        $keys = array_get($this->config, 'keys', ['*']);

        if (in_array('*', $keys)) {
            return $this->getWritableDefaultKeys();
        }

        return $keys;
    }
730664
public function write() {
        // Determine the width of the last column.
        $columnWidths = array_sum($this->columnWidths);
        $totalWidth = $this->indent + $columnWidths + $this->padding * (count($this->columnWidths) - 1);

        $lastWidth = end($this->columnWidths) + $this->maxWidth - $totalWidth;
        $lastWidth = max($lastWidth, 10); // min width of 10
        $this->columnWidths[count($this->columnWidths) - 1] = $lastWidth;

        // Loop through each row and write it.
        foreach ($this->rows as $row) {
            $rowLines = [];
            $lineCount = 0;

            // Split the cells into lines.
            foreach ($row as $i => $cell) {
                list($text,) = $cell;
                $width = $this->columnWidths[$i];

                $lines = Cli::breakLines($text, $width, $i < count($this->columnWidths) - 1);
                $rowLines[] = $lines;
                $lineCount = max($lineCount, count($lines));
            }

            // Write all of the lines.
            for ($i = 0; $i < $lineCount; $i++) {
                foreach ($rowLines as $j => $lines) {
                    $padding = $j === 0 ? $this->indent : $this->padding;

                    if (isset($lines[$i])) {
                        if ($this->formatOutput) {
                            if(isset($row[$j])) {
                                $wrap = $row[$j][1];
                            } else {
                                // if we're out of array, use the latest wraps
                                $wrap = $row[count($row)-1][1];
                            }

                            echo str_repeat(' ', $padding).$wrap[0].$lines[$i].$wrap[1];
                        } else {
                            echo str_repeat(' ', $padding).$lines[$i];
                        }
                    } elseif ($j < count($this->columnWidths) - 1) {
                        // This is an empty line. Write the spaces.
                        echo str_repeat(' ', $padding + $this->columnWidths[$j]);
                    }
                }
                echo PHP_EOL;
            }
        }
    }
432709
private function _writeSupbookInternal()
	{
		$record    = 0x01AE;   // Record identifier
		$length    = 0x0004;   // Bytes to follow

		$header    = pack("vv", $record, $length);
		$data      = pack("vv", $this->_phpExcel->getSheetCount(), 0x0401);
		return $this->writeData($header . $data);
	}
406332
public function stream_write($data)
    {
        if (! $this->temporaryFileHandle) {
            return 0;
        }
        
        $len = strlen($data);
        fwrite($this->temporaryFileHandle, $data, $len);
        return $len;
    }
1363156
public function setProperty( $section, $key, $value )
	{
		if( !$this->hasSection( $section ) )
			$this->addSection( $section );
		$this->data[$section][$key]	= $value;
		return is_int( $this->write() );
	}