Skip to content

RequestInspectionTrait

“Is this field empty/absent?” convenience helpers shared by WebRequest, one per input source (parameter, cookie, header, file).

trait RequestInspectionTrait

SourceRequest/RequestInspectionTrait.php
MethodDescription
hasCookie(string $name): boolIndicates whether or not a Cookie exists.
isCookieValueEmpty(string $name): boolChecks if there is a value of a cookie is empty or not set.
isFileValueEmpty(string $field): boolChecks if a file is empty, i.e.
isHeaderValueEmpty(string $name): boolChecks if there is a value of a header is empty or not set.
isParameterValueEmpty(string $field): boolChecks if there is a value of a parameter is empty or not set.
isValueEmpty(string $source, string $field): boolChecks if a field has no value (In web context this would only return true when the strings length is 0 or the field is not set.

public function hasCookie(string $name): bool

Indicates whether or not a Cookie exists.

ParameterTypeDescription
$namestring

Returns bool

public function isCookieValueEmpty(string $name): bool

Checks if there is a value of a cookie is empty or not set.

ParameterTypeDescription
$namestring

Returns bool

public function isFileValueEmpty(string $field): bool

Checks if a file is empty, i.e.

not set or set, but not actually uploaded.

ParameterTypeDescription
$fieldstring

Returns bool

public function isHeaderValueEmpty(string $name): bool

Checks if there is a value of a header is empty or not set.

ParameterTypeDescription
$namestring

Returns bool

public function isParameterValueEmpty(string $field): bool

Checks if there is a value of a parameter is empty or not set.

ParameterTypeDescription
$fieldstring

Returns bool

public function isValueEmpty(string $source, string $field): bool

Checks if a field has no value (In web context this would only return true when the strings length is 0 or the field is not set.

ParameterTypeDescription
$sourcestring
$fieldstring

Returns bool