1 | <?php |
||
7 | trait HelperMethods |
||
8 | { |
||
9 | /** |
||
10 | * @var SimpleXMLElement |
||
11 | */ |
||
12 | public $el; |
||
13 | |||
14 | /** |
||
15 | * Get a node attribute value. |
||
16 | * |
||
17 | * @param string $attribute |
||
18 | * @return string |
||
19 | */ |
||
20 | public function attr($attribute) |
||
24 | |||
25 | /** |
||
26 | * Get the first node matching an XPath query, or null if no match. |
||
27 | * |
||
28 | * @param string $path |
||
29 | * @return QuiteSimpleXMLElement |
||
30 | */ |
||
31 | public function first($path) |
||
38 | |||
39 | /** |
||
40 | * Check if the document has at least one node matching an XPath query. |
||
41 | * |
||
42 | * @param string $path |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function has($path) |
||
51 | |||
52 | /** |
||
53 | * Get all nodes matching an XPath query. |
||
54 | * |
||
55 | * @param string $path |
||
56 | * @return QuiteSimpleXMLElement[] |
||
57 | */ |
||
58 | public function xpath($path) |
||
64 | |||
65 | /** |
||
66 | * Alias for `xpath()`. |
||
67 | * |
||
68 | * @param $path |
||
69 | * @return QuiteSimpleXMLElement[] |
||
70 | */ |
||
71 | public function all($path) |
||
75 | |||
76 | |||
77 | } |