Maybe
in package
implements
ArrayAccess, Iterator, JsonSerializable
Class to represent any type of content.
This class can act as an object, array, or string. Method or property calls to this class won't cause any errors.
Maybe was used in Codeception 1.x to represent data on parsing step. Not widely used in 2.0 anymore, but left for compatibility.
For instance, you may use Codeception\Util\Maybe
as a test dummies.
<?php
$user = new Maybe;
$user->posts->comments->count();
?>
Table of Contents
Interfaces
- ArrayAccess
- Iterator
- JsonSerializable
Properties
- $assocArray : mixed
- $position : mixed
- $val : mixed
Methods
- __call() : mixed
- __clone() : mixed
- __construct() : mixed
- __get() : mixed
- __set() : mixed
- __toString() : mixed
- __unset() : mixed
- __value() : mixed
- current() : mixed
- (PHP 5 >= 5.0.0)<br/> Return the current element
- jsonSerialize() : mixed
- (PHP 5 >= 5.4.0) Serializes the object to a value that can be serialized natively by json_encode().
- key() : mixed
- (PHP 5 >= 5.0.0)<br/> Return the key of the current element
- next() : void
- (PHP 5 >= 5.0.0)<br/> Move forward to next element
- offsetExists() : mixed
- offsetGet() : mixed
- offsetSet() : mixed
- offsetUnset() : mixed
- rewind() : void
- (PHP 5 >= 5.0.0)<br/> Rewind the Iterator to the first element
- valid() : bool
- (PHP 5 >= 5.0.0)<br/> Checks if current position is valid
- isAssocArray() : mixed
Properties
$assocArray
protected
mixed
$assocArray
= null
$position
protected
mixed
$position
= 0
$val
protected
mixed
$val
= null
Methods
__call()
public
__call(mixed $method, mixed $args) : mixed
Parameters
- $method : mixed
- $args : mixed
__clone()
public
__clone() : mixed
__construct()
public
__construct([mixed $val = null ]) : mixed
Parameters
- $val : mixed = null
__get()
public
__get(mixed $key) : mixed
Parameters
- $key : mixed
__set()
public
__set(mixed $key, mixed $val) : mixed
Parameters
- $key : mixed
- $val : mixed
__toString()
public
__toString() : mixed
__unset()
public
__unset(mixed $key) : mixed
Parameters
- $key : mixed
__value()
public
__value() : mixed
current()
(PHP 5 >= 5.0.0)<br/> Return the current element
public
current() : mixed
Tags
Return values
mixed —Can return any type.
jsonSerialize()
(PHP 5 >= 5.4.0) Serializes the object to a value that can be serialized natively by json_encode().
public
jsonSerialize() : mixed
Tags
Return values
mixed —Returns data which can be serialized by json_encode(), which is a value of any type other than a resource.
key()
(PHP 5 >= 5.0.0)<br/> Return the key of the current element
public
key() : mixed
Tags
Return values
mixed —scalar on success, or null on failure.
next()
(PHP 5 >= 5.0.0)<br/> Move forward to next element
public
next() : void
Tags
Return values
void —Any returned value is ignored.
offsetExists()
public
offsetExists(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : mixed
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : mixed
Parameters
- $offset : mixed
rewind()
(PHP 5 >= 5.0.0)<br/> Rewind the Iterator to the first element
public
rewind() : void
Tags
Return values
void —Any returned value is ignored.
valid()
(PHP 5 >= 5.0.0)<br/> Checks if current position is valid
public
valid() : bool
Tags
Return values
bool —The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.
isAssocArray()
private
isAssocArray(mixed $arr) : mixed
Parameters
- $arr : mixed