SDK for PHP V3

MultipartStream
in package
implements StreamInterface Uses StreamDecoratorTrait

FinalYes

Stream that when read returns bytes for a streaming multipart or multipart/form-data stream.

Table of Contents

Interfaces

StreamInterface
Describes a data stream.

Methods

__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
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

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>

__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 any value accepted by Utils::streamFor() (scalar, null, resource, StreamInterface, Iterator, or callable), or an array for nested expansion. Optional keys include "headers" (associative array of custom headers) and "filename" (string to send as the filename in the part). When "contents" is an array, it is recursively expanded into multiple fields using bracket notation (e.g., name[0][key]). Empty arrays produce no fields. The "filename" and "headers" options cannot be used with array contents.

$boundary : string = null

You can optionally provide a specific boundary

Tags
throws
InvalidArgumentException

__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

detach()

public detach() : mixed

eof()

public eof() : bool
Return values
bool

getBoundary()

public getBoundary() : string
Return values
string

getContents()

public getContents() : string
Return values
string

getMetadata()

public getMetadata([mixed $key = null ]) : mixed
Parameters
$key : mixed = null

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

seek()

public seek(mixed $offset[, mixed $whence = SEEK_SET ]) : void
Parameters
$offset : mixed
$whence : mixed = SEEK_SET

tell()

public tell() : int
Return values
int

write()

public write(mixed $string) : int
Parameters
$string : mixed
Return values
int
<-- modeled_exceptions -->
On this page