Static guard helper class

Bridges the gap for allowing refactoring until traits can be used by default.

deprecated
package Default

 Methods

Verify that the data is not empty

guardAgainstEmpty(mixed $data, string $dataName = 'Argument', string $exceptionClass = self::DEFAULT_EXCEPTION_CLASS
Static

Parameters

$data

mixed

the data to verify

$dataName

string

the data name

$exceptionClass

string

FQCN for the exception

Exceptions

\Exception

Verify that the data is not null

guardAgainstNull(mixed $data, string $dataName = 'Argument', string $exceptionClass = self::DEFAULT_EXCEPTION_CLASS
Static

Parameters

$data

mixed

the data to verify

$dataName

string

the data name

$exceptionClass

string

FQCN for the exception

Exceptions

\Exception

Verifies that the data is an array or Traversable

guardForArrayOrTraversable(mixed $data, string $dataName = 'Argument', string $exceptionClass = self::DEFAULT_EXCEPTION_CLASS
Static

Parameters

$data

mixed

the data to verify

$dataName

string

the data name

$exceptionClass

string

FQCN for the exception

Exceptions

\Exception

 Constants

 

DEFAULT_EXCEPTION_CLASS

DEFAULT_EXCEPTION_CLASS = 'Zend\Stdlib\Exception\InvalidArgumentException'