Assert
Table of Contents
Methods
- expectArray() : array<string|int, mixed>
- Method checks if the given argument is an array
- expectArrayNotEmpty() : array<string|int, mixed>
- Method checks if the given argument is a non-empty array
- expectArrayOfUniqueIntegerNotNull() : array<string|int, int>
- Method checks if the given argument is a non-empty array of unique positive integers (or somehow can be casted to it)
- expectArrayOfUniqueStringNotNull() : array<string|int, string>
- Method checks if the given argument is a non-empty array of unique non-zero-length strings (or somehow can be casted to it)
- expectEnumerationMember() : array<string|int, mixed>
- Method checks if the given argument belongs to a set of elements
- expectInteger() : int
- Method checks if the given argument is an integer value, or can be casted to it. False and '' also allowed
- expectIntegerNonNegative() : int
- Method checks if the given argument is a non-negative integer value, or can be casted to it. False and '' also allowed
- expectIntegerPositive() : int
- Method checks if the given argument is a positive integer value, or can be casted to it
- expectStringNotNull() : string
- Method checks if the given argument is a non-zero-length string value, or can be casted to it
Methods
expectArray()
Method checks if the given argument is an array
public
final static expectArray(array<string|int, mixed> $arg[, string $argName = '' ][, string $customMsg = '' ]) : array<string|int, mixed>
Parameters
- $arg : array<string|int, mixed>
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
array<string|int, mixed> —value being checked
expectArrayNotEmpty()
Method checks if the given argument is a non-empty array
public
final static expectArrayNotEmpty(array<string|int, mixed> $arg[, string $argName = '' ][, string $customMsg = '' ]) : array<string|int, mixed>
Parameters
- $arg : array<string|int, mixed>
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
array<string|int, mixed> —value being checked
expectArrayOfUniqueIntegerNotNull()
Method checks if the given argument is a non-empty array of unique positive integers (or somehow can be casted to it)
public
final static expectArrayOfUniqueIntegerNotNull(array<string|int, mixed> $arg[, string $argName = '' ][, string $customMsg = '' ]) : array<string|int, int>
Parameters
- $arg : array<string|int, mixed>
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
array<string|int, int> —checked and casted value
expectArrayOfUniqueStringNotNull()
Method checks if the given argument is a non-empty array of unique non-zero-length strings (or somehow can be casted to it)
public
final static expectArrayOfUniqueStringNotNull(array<string|int, mixed> $arg[, string $argName = '' ][, string $customMsg = '' ]) : array<string|int, string>
Parameters
- $arg : array<string|int, mixed>
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
array<string|int, string> —checked and casted value
expectEnumerationMember()
Method checks if the given argument belongs to a set of elements
public
final static expectEnumerationMember(array<string|int, mixed> $arg[, array<string|int, mixed> $enum = [] ][, string $argName = '' ][, string $customMsg = '' ]) : array<string|int, mixed>
Parameters
- $arg : array<string|int, mixed>
-
Argument to check.
- $enum : array<string|int, mixed> = []
-
Enumeration to check argument belong to.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
array<string|int, mixed> —checked and casted value
expectInteger()
Method checks if the given argument is an integer value, or can be casted to it. False and '' also allowed
public
final static expectInteger(mixed $arg[, string $argName = '' ][, string $customMsg = '' ]) : int
Parameters
- $arg : mixed
-
Argument to check.
- $argName : string = ''
-
Aargument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
int —checked and casted value
expectIntegerNonNegative()
Method checks if the given argument is a non-negative integer value, or can be casted to it. False and '' also allowed
public
final static expectIntegerNonNegative(mixed $arg[, string $argName = '' ][, string $customMsg = '' ]) : int
Parameters
- $arg : mixed
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
int —checked and casted value
expectIntegerPositive()
Method checks if the given argument is a positive integer value, or can be casted to it
public
final static expectIntegerPositive(mixed $arg[, string $argName = '' ][, string $customMsg = '' ]) : int
Parameters
- $arg : mixed
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
int —checked and casted value
expectStringNotNull()
Method checks if the given argument is a non-zero-length string value, or can be casted to it
public
final static expectStringNotNull(mixed $arg[, string $argName = '' ][, string $customMsg = '' ]) : string
Parameters
- $arg : mixed
-
Argument to check.
- $argName : string = ''
-
Argument name to figure in a error message.
- $customMsg : string = ''
-
Custom message to be shown instead of a standard one.
Tags
Return values
string —checked and casted value