class MultipartBodyRepository implements BodyRepository, MergeableBody

Traits

Properties

protected MultipartValue> $data

The multipart values.

protected string $boundary

The multipart boundary.

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

__construct(array $value = [], string|null $boundary = null)

Create a multipart body repository.

set(mixed $value)

Set the repository value.

merge(array ...$arrays)

Merge arrays into the repository.

add(string $name, mixed $contents, string|null $filename = null, array $headers = [])

Add an element to the repository.

attach(MultipartValue $file)

Attach a multipart value.

mixed
all()

Get the raw data in the repository.

mixed
get(string $key, mixed $default = null)

Get values with the given name.

remove(string $key)

Remove an item from the repository.

bool
isEmpty()

Determine if the repository is empty.

bool
isNotEmpty()

Determine if the repository is not empty.

array
parseMultipartArray(array $value)

Parse a multipart array.

string
boundary()

Get the multipart boundary.

string
contentType()

Get the boundary-aware multipart content type.

StreamInterface
toStream()

Convert the body repository into a stream.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 37
__construct(array $value = [], string|null $boundary = null)

Create a multipart body repository.

Parameters

array $value
string|null $boundary

at line 50
BodyRepository set(mixed $value)

Set the repository value.

Parameters

mixed $value

Return Value

BodyRepository

at line 67
MergeableBody merge(array ...$arrays)

Merge arrays into the repository.

Parameters

array ...$arrays

Return Value

MergeableBody

at line 83
MultipartBodyRepository add(string $name, mixed $contents, string|null $filename = null, array $headers = [])

Add an element to the repository.

Parameters

string $name
mixed $contents
string|null $filename
array $headers

Return Value

MultipartBodyRepository

at line 95
MultipartBodyRepository attach(MultipartValue $file)

Attach a multipart value.

Parameters

MultipartValue $file

Return Value

MultipartBodyRepository

at line 107
mixed all()

Get the raw data in the repository.

Return Value

mixed

at line 115
mixed get(string $key, mixed $default = null)

Get values with the given name.

Parameters

string $key
mixed $default

Return Value

mixed

at line 137
MultipartBodyRepository remove(string $key)

Remove an item from the repository.

Parameters

string $key

Return Value

MultipartBodyRepository

at line 151
bool isEmpty()

Determine if the repository is empty.

Return Value

bool

at line 159
bool isNotEmpty()

Determine if the repository is not empty.

Return Value

bool

at line 170
protected array parseMultipartArray(array $value)

Parse a multipart array.

Parameters

array $value

Return Value

array

at line 184
string boundary()

Get the multipart boundary.

Return Value

string

at line 192
string contentType()

Get the boundary-aware multipart content type.

Return Value

string

at line 200
StreamInterface toStream()

Convert the body repository into a stream.

Return Value

StreamInterface