MultipartStream
in package
implements
StreamInterface
Uses
StreamDecoratorTrait
Stream that when read returns bytes for a streaming multipart or multipart/form-data stream.
Interfaces, Classes, Traits and Enums
- StreamInterface
- Describes a data stream.
Table of Contents
- $boundary : string
- $stream : StreamInterface
- __call() : mixed
- Allow decorators to implement custom methods
- __construct() : mixed
- __get() : StreamInterface
- Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
- __toString() : string
- close() : void
- detach() : mixed
- eof() : bool
- getBoundary() : string
- getContents() : string
- getMetadata() : mixed
- {@inheritdoc}
- getSize() : int|null
- isReadable() : bool
- isSeekable() : bool
- isWritable() : bool
- Returns whether or not the stream is writable.
- read() : string
- rewind() : void
- seek() : void
- tell() : int
- write() : int
- createStream() : StreamInterface
- Create the aggregate stream that will be used to upload the POST data
- addElement() : void
- createElement() : array<string|int, mixed>
- getHeader() : mixed
- getHeaders() : string
- Get the headers needed before transferring the content of a POST file
Properties
$boundary
private
string
$boundary
$stream
private
StreamInterface
$stream
Methods
__call()
Allow decorators to implement custom methods
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
- $args : array<string|int, mixed>
Return values
mixed —__construct()
public
__construct([array<string|int, mixed> $elements = [] ][, string $boundary = null ]) : mixed
Parameters
- $elements : array<string|int, mixed> = []
-
Array of associative arrays, each containing a required "name" key mapping to the form field, name, a required "contents" key mapping to a StreamInterface/resource/string, an optional "headers" associative array of custom headers, and an optional "filename" key mapping to a string to send as the filename in the part.
- $boundary : string = null
-
You can optionally provide a specific boundary
Tags
Return values
mixed —__get()
Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
public
__get(string $name) : StreamInterface
Parameters
- $name : string
Return values
StreamInterface —__toString()
public
__toString() : string
Return values
string —close()
public
close() : void
Return values
void —detach()
public
detach() : mixed
Return values
mixed —eof()
public
eof() : bool
Return values
bool —getBoundary()
public
getBoundary() : string
Return values
string —getContents()
public
getContents() : string
Return values
string —getMetadata()
{@inheritdoc}
public
getMetadata([mixed $key = null ]) : mixed
Parameters
- $key : mixed = null
Return values
mixed —getSize()
public
getSize() : int|null
Return values
int|null —isReadable()
public
isReadable() : bool
Return values
bool —isSeekable()
public
isSeekable() : bool
Return values
bool —isWritable()
Returns whether or not the stream is writable.
public
isWritable() : bool
Return values
bool —read()
public
read(mixed $length) : string
Parameters
- $length : mixed
Return values
string —rewind()
public
rewind() : void
Return values
void —seek()
public
seek(mixed $offset[, mixed $whence = SEEK_SET ]) : void
Parameters
- $offset : mixed
- $whence : mixed = SEEK_SET
Return values
void —tell()
public
tell() : int
Return values
int —write()
public
write(mixed $string) : int
Parameters
- $string : mixed
Return values
int —createStream()
Create the aggregate stream that will be used to upload the POST data
protected
createStream([array<string|int, mixed> $elements = [] ]) : StreamInterface
Parameters
- $elements : array<string|int, mixed> = []
Return values
StreamInterface —addElement()
private
addElement(AppendStream $stream, array<string|int, mixed> $element) : void
Parameters
- $stream : AppendStream
- $element : array<string|int, mixed>
Return values
void —createElement()
private
createElement(string $name, StreamInterface $stream, string|null $filename, array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
- $name : string
- $stream : StreamInterface
- $filename : string|null
- $headers : array<string|int, mixed>
Return values
array<string|int, mixed> —getHeader()
private
getHeader(array<string|int, mixed> $headers, string $key) : mixed
Parameters
- $headers : array<string|int, mixed>
- $key : string
Return values
mixed —getHeaders()
Get the headers needed before transferring the content of a POST file
private
getHeaders(array<string, string> $headers) : string
Parameters
- $headers : array<string, string>