Fr3nch13/CakePHP Utilities

MissingOptionException extends ConsoleException
in package

Exception raised with suggestions

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()}
$requested  : string
The requested thing that was not found.
$suggestions  : array<string|int, string>
The valid suggestions.

Methods

__construct()  : mixed
Constructor.
getAttributes()  : array<string|int, mixed>
Get the passed in attributes
getCode()  : int
getFullMessage()  : string
Get the message with suggestions
responseHeader()  : array<string|int, mixed>|null
Get/set the response header to be used
findClosestItem()  : string
Find the best match for requested in suggestions

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 = \Cake\Console\CommandInterface::CODE_ERROR

$_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

Methods

__construct()

Constructor.

public __construct(string $message[, string $requested = '' ][, array<string|int, string> $suggestions = [] ][, int|null $code = null ][, Throwable|null $previous = null ]) : mixed
Parameters
$message : string

The string message.

$requested : string = ''

The requested value.

$suggestions : array<string|int, string> = []

The list of potential values that were valid.

$code : int|null = null

The exception code if relevant.

$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
int

getFullMessage()

Get the message with suggestions

public getFullMessage() : string
Return values
string

responseHeader()

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.

See also

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.

Return values
array<string|int, mixed>|null

findClosestItem()

Find the best match for requested in suggestions

protected findClosestItem(string $needle, array<string|int, string> $haystack) : string
Parameters
$needle : string

Unknown option name trying to be used.

$haystack : array<string|int, string>

Suggestions to look through.

Return values
string

The best match


        
On this page

Search results