PHP Class FluentDOM\Constraints

Show file Open project: fluentdom/fluentdom Class Usage Examples

Public Methods

Method Description
assertNode ( mixed $node, string $message = 'DOMNode expected, got: %s.' ) : boolean
hasOption ( integer $options, integer $option ) : boolean Check options bitmask for an option
isCallable ( mixed $callback, boolean $allowGlobalFunctions = FALSE, boolean $silent = TRUE ) : callable | null check if parameter is a valid callback function. It returns the callable or NULL.
isNode ( mixed $node, boolean $ignoreTextNodes = FALSE ) : DOMElement | DOMText | DOMCdataSection Check if the DOMNode is DOMElement or DOMText with content.
isNodeList ( mixed $elements ) : Traversable | array Check if $elements is a traversable node list. It returns the $elements or NULL

Private Methods

Method Description
isCallableArray ( mixed $callback ) : boolean Return TRUE if the $callback is an array that can be an

Method Details

assertNode() public static method

public static assertNode ( mixed $node, string $message = 'DOMNode expected, got: %s.' ) : boolean
$node mixed
$message string
return boolean

hasOption() public static method

Check options bitmask for an option
public static hasOption ( integer $options, integer $option ) : boolean
$options integer
$option integer
return boolean

isCallable() public static method

If $silent is disabled, an exception is thrown for invalid callbacks
public static isCallable ( mixed $callback, boolean $allowGlobalFunctions = FALSE, boolean $silent = TRUE ) : callable | null
$callback mixed
$allowGlobalFunctions boolean
$silent boolean (no InvalidArgumentException)
return callable | null

isNode() public static method

It returns the node or NULL.
public static isNode ( mixed $node, boolean $ignoreTextNodes = FALSE ) : DOMElement | DOMText | DOMCdataSection
$node mixed
$ignoreTextNodes boolean
return DOMElement | DOMText | DOMCdataSection

isNodeList() public static method

Check if $elements is a traversable node list. It returns the $elements or NULL
public static isNodeList ( mixed $elements ) : Traversable | array
$elements mixed
return Traversable | array