Write to stream.

@see http://php.net/manual/en/splfileobject.fwrite.php

@return int|bool
480466
public function fwrite(string $str, int $length = null)
    {
        $args = [$this->stream, $str];
        if (null !== $length) {
            $args[] = $length;
        }

        return fwrite(...$args);
    }
783663
public function write($string):int {
		if(!$this->isWritable()) {
			throw new StreamException("Stream is not writable");
		}

		return fwrite($this->stream, $string);
	}
172305
public function write(string $data): int
    {
        $length = fputs($this->resource, $data, strlen($data));
        if (false === $length) {
            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Writing of ' . strlen($data) . ' bytes failed:'
                        . ' timeout of ' . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Writing of ' . strlen($data) . ' bytes failed.'
            );
        }

        return $length;
    }
61273
public final function write($string): int
   {
       if (!$this->isWritable()) {
           throw new RuntimeException("Can't write: stream is not writable");
       }
       $this->meta["eof"] = true;
	   if (($size = (int) fwrite($this->stream, (string) $string))) {
		    $this->meta["size"] = $this->getMetadata("size") + $size;
	   }
       return $size;
   }
970600
public function write($data = null) {
		if (!is_resource($this->_resource)) {
			return false;
		}
		if (!is_object($data)) {
			$data = $this->_instance($this->_classes['request'], (array) $data + $this->_config);
		}
		return stream_context_set_option(
			$this->_resource, $data->to('context', ['timeout' => $this->_timeout])
		);
	}
21953
function write($content, $inByte = null)
    {
        $this->_assertWritable();

        $stream = $this->resource()->getRHandler();

        $inByte = ($inByte === null)
            ? $this->getBuffer()
            : $inByte;


        $content = (string) $content;
        if (null === $inByte)
            $ret = fwrite($stream, $content);
        else
            $ret = fwrite($stream, $content, $inByte);

        if (false === $ret)
            throw new \RuntimeException('Cannot write on stream.');

        $transCount = $inByte;
        if ($transCount === null) {
            if (function_exists('mb_strlen'))
                $transCount = mb_strlen($content, '8bit');
            else
                $transCount = strlen($content);
        }

        $this->_resetTransCount($transCount);
        return $this;
    }
726725
public function write()
    {
        // If the local filesystem has the uploaded file
        if (file_exists($this->file->getRealPath()))
        {
            // Read the local uploaded file
            $file = file_get_contents($this->file->getRealPath());

            // Write it to the S3 location
            return $this->remote->write($this->attributes['upload_to'] . '/' . $this->attributes['filename'], $file, ['visibility' => 'public']);
        }

        throw new Exception('The uploaded file was not found on the filesystem');
    }
928884
public function fwrite(string $data): int
    {
        $len = dechex(strlen($data));
        $written = fwrite($this->peer, "${len}\r\n${data}\r\n");
        if (!$written) {
            $msg = 'Cannot write to socket';
            throw new Exception\RuntimeException($msg);
        }

        return $written;
    }
1280314
public function write($data)
    {
        if (!$this->alive) {
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
            return false;
        }
        if (!isset($this->bevWrite)) {
            return false;
        }
        if (!mb_orig_strlen($data)) {
            return true;
        }
        $this->writing = true;
        Daemon::$noError = true;
        if (!$this->bevWrite->write($data) || !Daemon::$noError) {
            $this->close();
            return false;
        }
        return true;
    }
24956
public function getOutput() {
		// create stream handle for the output
		$handle = fopen('php://temp/maxmemory:'.(1*1024*1024), 'r+'); // 1MB

		fwrite($handle, '<?xml version="1.0"?>');
		
		// count subkeys. if there is more than one we have to generate an auto container
		// we have to take care of attributes
		$count = 0;
		foreach ($this->_content['content'] as $key => $item) {
			if ($key{0} != ':') $count++;
		}
		
		if ($count != 1) $this->_content['content'] = ['auto-container' => $this->_content['content']];
		fwrite($handle, $this -> _outputXML($this->_content['content']));
		return $handle;
	}
921032
public function write()
    {
        $lines = array();

        foreach ($this->data as $fetch) {
            $data = array($fetch['url'], $fetch['length'], $fetch['filename']);
            array_push($lines, join(' ', $data) . "\n");
        }

        if (count($lines) == 0) {
            if (file_exists($this->fileName)) {
                unlink($this->fileName);
            }
        } else {
            writeFileText($this->fileName, $this->fileEncoding, join('', $lines));
        }
    }
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 );
	}
661021
public function write()
    {
        $filename = $this->isFileWritable() ? $this->filename : $this->getCacheFilename();

        return file_put_contents($filename, $this->render());
    }
311450
public function write($string)
    {
        if ($this->isWritable()) {
            $size = $this->getSize();
            $count = fwrite($this->stream, $string);
            $this->setSize($size + $count);
            return $count;
        } else {
            return false;
        }
    }
399096
public function write($string)
    {
        $result = fwrite($this->stream, $string);
        if(false === $result)
        {
            throw new \RuntimeException('write stream failed');
        }
        return $result;
    }
1072217
public function stream_write($data)
	{
		$left = substr($this->buffers[$this->name], 0, $this->position);
		$right = substr($this->buffers[$this->name], $this->position + strlen($data));
		$this->buffers[$this->name] = $left . $data . $right;
		$this->position += strlen($data);

		return strlen($data);
	}
1192567
public function write($string)
    {
        $this->valideAttach()->valideWrite();
        if (($stream = fwrite($this->stream, $string)) === false) {
            throw new \RuntimeException('An error has occurred.');
        }

        return $stream;
    }