1 | <?php |
||
14 | abstract class Constraints { |
||
15 | |||
16 | |||
17 | /** |
||
18 | * Check if the DOMNode is DOMElement or DOMText with content. |
||
19 | * It returns the node or NULL. |
||
20 | * |
||
21 | * @param mixed $node |
||
22 | * @param bool $ignoreTextNodes |
||
23 | * @return \DOMElement|\DOMText|\DOMCdataSection |
||
24 | */ |
||
25 | 7 | public static function filterNode($node, $ignoreTextNodes = FALSE) { |
|
43 | |||
44 | /** |
||
45 | * @param mixed $node |
||
46 | * @param string $message |
||
47 | * @return bool |
||
48 | * @throws \InvalidArgumentException |
||
49 | */ |
||
50 | 5 | public static function assertNode($node, $message = 'DOMNode expected, got: %s.'): bool { |
|
61 | |||
62 | /** |
||
63 | * Check if $elements is a traversable node list. It returns |
||
64 | * the $elements or NULL |
||
65 | * |
||
66 | * @param mixed $elements |
||
67 | * @return \Traversable|array |
||
68 | */ |
||
69 | 4 | public static function filterNodeList($elements) { |
|
76 | |||
77 | /** |
||
78 | * check if parameter is a valid callback function. It returns |
||
79 | * the callable or NULL. |
||
80 | * |
||
81 | * If $silent is disabled, an exception is thrown for invalid callbacks |
||
82 | * |
||
83 | * @param mixed $callback |
||
84 | * @param bool $allowGlobalFunctions |
||
85 | * @param bool $silent (no InvalidArgumentException) |
||
86 | * @throws \InvalidArgumentException |
||
87 | * @return callable|NULL |
||
88 | */ |
||
89 | 9 | public static function filterCallable($callback, $allowGlobalFunctions = FALSE, $silent = TRUE) { |
|
104 | |||
105 | /** |
||
106 | * Return TRUE if the $callback is an array that can be an |
||
107 | * |
||
108 | * @param mixed $callback |
||
109 | * @return bool |
||
110 | */ |
||
111 | 5 | private static function filterCallableArray($callback) { |
|
119 | |||
120 | /** |
||
121 | * Check options bitmask for an option |
||
122 | * |
||
123 | * @param int $options |
||
124 | * @param int $option |
||
125 | * @return bool |
||
126 | */ |
||
127 | 2 | public static function hasOption($options, $option): bool { |
|
130 | } |
||
131 | } |