Requests 2.0.0 API

ArgumentCount extends Exception
in package

Exception for when an incorrect number of arguments are passed to a method.

Typically, this exception is used when all arguments for a method are optional, but certain arguments need to be passed together, i.e. a method which can be called with no arguments or with two arguments, but not with one argument.

Along the same lines, this exception is also used if a method expects an array with a certain number of elements and the provided number of elements does not comply.

Tags
since
2.0.0

Table of Contents

$data  : mixed
Data associated with the exception
$type  : string
Type of exception
__construct()  : mixed
Create a new exception
create()  : ArgumentCount
Create a new argument count exception with a standardized text.
getData()  : mixed
Gives any relevant data
getType()  : string
Like {@see \Exception::getCode()}, but a string code.

Properties

$data

Data associated with the exception

protected mixed $data

$type

Type of exception

protected string $type

Methods

__construct()

Create a new exception

public __construct(string $message, string $type[, mixed $data = null ], int $code) : mixed
Parameters
$message : string

Exception message

$type : string

Exception type

$data : mixed = null

Associated data

$code : int

Exception numerical code, if applicable

Return values
mixed

create()

Create a new argument count exception with a standardized text.

public static create(string $expected, int $received, string $type) : ArgumentCount
Parameters
$expected : string

The argument count expected as a phrase. For example: at least 2 arguments or exactly 1 argument.

$received : int

The actual argument count received.

$type : string

Exception type.

Return values
ArgumentCount

getData()

Gives any relevant data

public getData() : mixed
Return values
mixed

getType()

Like {@see \Exception::getCode()}, but a string code.

public getType() : string
Return values
string

Search results