$value
$value : mixed
Base object, mother of all classes of this package.
It contains some validation processes, basic magic getter to get internal
value and __toString()
feature.
search(mixed $foo) : mixed
Search index of the given element.
This will return the first index found for the given element if there are several identical.
If no element found, then return null.
If element is found, then S object is returned.
mixed | $foo | The element to find |
mustBeStringOrScalar(mixed $arg, string $arg_name) : void
Checks whether given value is string-like or scalar type.
Value must be of string-like type (string or object having
__toString()
method) or a basic scalar type.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeString(mixed $arg, string $arg_name) : void
Checks whether given value is string-like type.
A string-like value is string or object having __toString()
method.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeInteger(mixed $arg, string $arg_name) : void
Checks whether given value is integer-like type.
An integer-like value is integer or \Malenki\Bah\N
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeFloat(mixed $arg, string $arg_name) : void
Checks whether given value is float-like type.
A float-like value is float or \Malenki\Bah\N
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeDouble(mixed $arg, string $arg_name) : void
Checks whether given value is double-like type.
A double-like value is string or \Malenki\Bah\N
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeNumeric(mixed $arg, string $arg_name) : void
Checks whether given value is numeric-like type.
A numeric-like value is numeric (integer, float or double) or
\Malenki\Bah\N
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeArray(mixed $arg, string $arg_name) : void
Checks whether given value is an array-like type.
A array-like value is an array or \Malenki\Bah\A
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeHash(mixed $arg, string $arg_name) : void
Checks whether given value is a hash-like type.
A hash-like value is an array having named-index or \Malenki\Bah\H
object.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeArrayOrHash(mixed $arg, string $arg_name) : void
Checks whether given value is an array-like or hash-like type.
The aim of this method is only to raise \InvalidArgumentException
if
given value has not the good type.
mixed | $arg | The value to test. |
string | $arg_name | Optional name of the value, used into exception’s message. |
If value’s type is not valid
mustBeCallable(mixed $arg, mixed $arg_name) : void
Checks whether the given argument is callable.
This is usefull to test is an argument can be call as a function. If
this argument is not callable, then this raises an
\InvalidArgumentException
.
mixed | $arg | The value to test |
mixed | $arg_name | Optional name of the value, used into error message |
If arg is not callable