Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | ||||||
__construct (array $streams=[]) | ||||||
__toString () | ||||||
Reads all data from the stream into a string, from the beginning to end. | ||||||
addStream (StreamInterface $stream) | ||||||
Add a stream to the AppendStream. | ||||||
close () | ||||||
Closes each attached stream. | ||||||
detach () | ||||||
Detaches each attached stream. | ||||||
eof () | ||||||
Returns true if the stream is at the end of the stream. | ||||||
getContents () | ||||||
Returns the remaining contents in a string. | ||||||
getMetadata ($key=null) | ||||||
{Get stream metadata as an associative array or retrieve a specific key.The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.@externalurl http://php.net/manual/en/function.stream-get-meta-data.php
| ||||||
getSize () | ||||||
Tries to calculate the size by adding the size of each stream. | ||||||
isReadable () | ||||||
Returns whether or not the stream is readable. | ||||||
isSeekable () | ||||||
Returns whether or not the stream is seekable. | ||||||
isWritable () | ||||||
Returns whether or not the stream is writable. | ||||||
read ($length) | ||||||
Reads from all of the appended streams until the length is met or EOF. | ||||||
rewind () | ||||||
Seek to the beginning of the stream. | ||||||
seek ($offset, $whence=SEEK_SET) | ||||||
Attempts to seek to the given position. | ||||||
tell () | ||||||
Returns the current position of the file read/write pointer. | ||||||
write ($string) | ||||||
Write data to the stream. | ||||||
GuzzleHttp\Psr7\AppendStream::__construct | ( | array | $streams = [] | ) |
StreamInterface[] | $streams | Streams to decorate. Each stream must be readable. |
GuzzleHttp\Psr7\AppendStream::__toString | ( | ) |
Reads all data from the stream into a string, from the beginning to end.
This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.
Warning: This could attempt to load a large amount of data into memory.
This method MUST NOT raise an exception in order to conform with PHP's string casting operations.
string |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::addStream | ( | StreamInterface | $stream | ) |
Add a stream to the AppendStream.
StreamInterface | $stream | Stream to append. Must be readable. |
InvalidArgumentException | if the stream is not readable |
GuzzleHttp\Psr7\AppendStream::close | ( | ) |
Closes each attached stream.
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::detach | ( | ) |
Detaches each attached stream.
Returns null as it's not clear which underlying stream resource to return.
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::eof | ( | ) |
Returns true if the stream is at the end of the stream.
bool |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::getContents | ( | ) |
Returns the remaining contents in a string.
string |
RuntimeException | if unable to read or an error occurs while reading. |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::getMetadata | ( | $key = null | ) |
{Get stream metadata as an associative array or retrieve a specific key.The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.@externalurl http://php.net/manual/en/function.stream-get-meta-data.php
string | $key | Specific metadata to retrieve. |
array|mixed|null | Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found. |
mixed |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::getSize | ( | ) |
Tries to calculate the size by adding the size of each stream.
If any of the streams do not return a valid number, then the size of the append stream cannot be determined and null is returned.
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::isReadable | ( | ) |
Returns whether or not the stream is readable.
bool |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::isSeekable | ( | ) |
Returns whether or not the stream is seekable.
bool |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::isWritable | ( | ) |
Returns whether or not the stream is writable.
bool |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::read | ( | $length | ) |
Reads from all of the appended streams until the length is met or EOF.
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::rewind | ( | ) |
Seek to the beginning of the stream.
If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).
RuntimeException | on failure. |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::seek | ( | $offset, | |
$whence = SEEK_SET ) |
Attempts to seek to the given position.
Only supports SEEK_SET.
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::tell | ( | ) |
Returns the current position of the file read/write pointer.
int | Position of the file pointer |
RuntimeException | on error. |
Implements Psr\Http\Message\StreamInterface.
GuzzleHttp\Psr7\AppendStream::write | ( | $string | ) |
Write data to the stream.
string | $string | The string that is to be written. |
int | Returns the number of bytes written to the stream. |
RuntimeException | on failure. |
Implements Psr\Http\Message\StreamInterface.