HumHub Documentation (unofficial)

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 &gt;= 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 &gt;= 5.0.0)<br/> Return the key of the current element
next()  : void
(PHP 5 &gt;= 5.0.0)<br/> Move forward to next element
offsetExists()  : mixed
offsetGet()  : mixed
offsetSet()  : mixed
offsetUnset()  : mixed
rewind()  : void
(PHP 5 &gt;= 5.0.0)<br/> Rewind the Iterator to the first element
valid()  : bool
(PHP 5 &gt;= 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

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

valid()

(PHP 5 &gt;= 5.0.0)<br/> Checks if current position is valid

public valid() : bool
Tags
link
https://php.net/manual/en/iterator.valid.php
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

        
On this page

Search results