InvalidParameterException
extends CakeException
in package
Used when a passed parameter or action parameter type declaration is missing or invalid.
Table of Contents
Properties
- $_attributes : array<string|int, mixed>
- Array of attributes that are passed in from the constructor, and made available in the view when a development error is displayed.
- $_defaultCode : int
- Default exception code
- $_messageTemplate : string
- Template string that has attributes sprintf()'ed into it.
- $_responseHeaders : array<string|int, mixed>|null
- Array of headers to be passed to {@link \Cake\Http\Response::withHeader()}
- $templates : array<string, string>
Methods
- __construct() : mixed
- Switches message template based on `template` key in message array.
- getAttributes() : array<string|int, mixed>
- Get the passed in attributes
- getCode() : int
- responseHeader() : array<string|int, mixed>|null
- Get/set the response header to be used
Properties
$_attributes
Array of attributes that are passed in from the constructor, and made available in the view when a development error is displayed.
protected
array<string|int, mixed>
$_attributes
= []
$_defaultCode
Default exception code
protected
int
$_defaultCode
= 0
$_messageTemplate
Template string that has attributes sprintf()'ed into it.
protected
string
$_messageTemplate
= ''
$_responseHeaders
Array of headers to be passed to {@link \Cake\Http\Response::withHeader()}
protected
array<string|int, mixed>|null
$_responseHeaders
$templates
protected
array<string, string>
$templates
= ['failed_coercion' => 'Unable to coerce "%s" to `%s` for `%s` in action %s::%s().', 'missing_dependency' => 'Failed to inject dependency from service container for parameter `%s` ' . 'with type `%s` in action %s::%s().', 'missing_parameter' => 'Missing passed parameter for `%s` in action %s::%s().', 'unsupported_type' => 'Type declaration for `%s` in action %s::%s() is unsupported.']
Methods
__construct()
Switches message template based on `template` key in message array.
public
__construct([string|array<string|int, mixed> $message = '' ][, int|null $code = null ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string|array<string|int, mixed> = ''
-
Either the string of the error message, or an array of attributes that are made available in the view, and sprintf()'d into Exception::$_messageTemplate
- $code : int|null = null
-
The error code
- $previous : Throwable|null = null
-
the previous exception.
getAttributes()
Get the passed in attributes
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getCode()
public
getCode() : int
Gets the Exception code.
Return values
intresponseHeader()
Get/set the response header to be used
public
responseHeader([array<string|int, mixed>|string|null $header = null ][, string|null $value = null ]) : array<string|int, mixed>|null
Use HttpException::setHeaders()
instead. Response headers
should be set for HttpException only.
Parameters
- $header : array<string|int, mixed>|string|null = null
-
A single header string or an associative array of "header name" => "header value"
- $value : string|null = null
-
The header value.