@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | class Document extends DOMDocument |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * @link https://www.php.net/manual/domdocument.construct.php |
|
| 19 | - * |
|
| 20 | - * @param string $version Version number of the document |
|
| 21 | - * @param string $encoding Encoding of the document |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 18 | + * @link https://www.php.net/manual/domdocument.construct.php |
|
| 19 | + * |
|
| 20 | + * @param string $version Version number of the document |
|
| 21 | + * @param string $encoding Encoding of the document |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | 24 | public function __construct(string $version = '1.0', string $encoding = 'utf-8') |
| 25 | 25 | { |
| 26 | 26 | parent::__construct($version, $encoding); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Create and return an xsl:apply-templates element |
|
| 33 | - * |
|
| 34 | - * @param string $select XPath expression for the "select" attribute |
|
| 35 | - * @return Element |
|
| 36 | - */ |
|
| 32 | + * Create and return an xsl:apply-templates element |
|
| 33 | + * |
|
| 34 | + * @param string $select XPath expression for the "select" attribute |
|
| 35 | + * @return Element |
|
| 36 | + */ |
|
| 37 | 37 | public function createXslApplyTemplates(string $select = null): Element |
| 38 | 38 | { |
| 39 | 39 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:apply-templates'); |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Create and return an xsl:choose element |
|
| 50 | - * |
|
| 51 | - * @return Element |
|
| 52 | - */ |
|
| 49 | + * Create and return an xsl:choose element |
|
| 50 | + * |
|
| 51 | + * @return Element |
|
| 52 | + */ |
|
| 53 | 53 | public function createXslChoose(): Element |
| 54 | 54 | { |
| 55 | 55 | return $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:choose'); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * Create and return an xsl:copy-of element |
|
| 60 | - * |
|
| 61 | - * @param string $select XPath expression for the "select" attribute |
|
| 62 | - * @return Element |
|
| 63 | - */ |
|
| 59 | + * Create and return an xsl:copy-of element |
|
| 60 | + * |
|
| 61 | + * @param string $select XPath expression for the "select" attribute |
|
| 62 | + * @return Element |
|
| 63 | + */ |
|
| 64 | 64 | public function createXslCopyOf(string $select): Element |
| 65 | 65 | { |
| 66 | 66 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:copy-of'); |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * Create and return an xsl:if element |
|
| 74 | - * |
|
| 75 | - * @param string $test XPath expression for the "test" attribute |
|
| 76 | - * @return Element |
|
| 77 | - */ |
|
| 73 | + * Create and return an xsl:if element |
|
| 74 | + * |
|
| 75 | + * @param string $test XPath expression for the "test" attribute |
|
| 76 | + * @return Element |
|
| 77 | + */ |
|
| 78 | 78 | public function createXslIf(string $test): Element |
| 79 | 79 | { |
| 80 | 80 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:if'); |
@@ -84,22 +84,22 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Create and return an xsl:otherwise element |
|
| 88 | - * |
|
| 89 | - * @return Element |
|
| 90 | - */ |
|
| 87 | + * Create and return an xsl:otherwise element |
|
| 88 | + * |
|
| 89 | + * @return Element |
|
| 90 | + */ |
|
| 91 | 91 | public function createXslOtherwise(): Element |
| 92 | 92 | { |
| 93 | 93 | return $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:otherwise'); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | - * Create and return an xsl:param element |
|
| 98 | - * |
|
| 99 | - * @param string $name Name of the parameter |
|
| 100 | - * @param string $select XPath expression |
|
| 101 | - * @return Element |
|
| 102 | - */ |
|
| 97 | + * Create and return an xsl:param element |
|
| 98 | + * |
|
| 99 | + * @param string $name Name of the parameter |
|
| 100 | + * @param string $select XPath expression |
|
| 101 | + * @return Element |
|
| 102 | + */ |
|
| 103 | 103 | public function createXslParam(string $name, string $select = null): Element |
| 104 | 104 | { |
| 105 | 105 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:param'); |
@@ -113,22 +113,22 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Create and return an xsl:text element |
|
| 117 | - * |
|
| 118 | - * @param string $text Text content for the element |
|
| 119 | - * @return Element |
|
| 120 | - */ |
|
| 116 | + * Create and return an xsl:text element |
|
| 117 | + * |
|
| 118 | + * @param string $text Text content for the element |
|
| 119 | + * @return Element |
|
| 120 | + */ |
|
| 121 | 121 | public function createXslText(string $text = ''): Element |
| 122 | 122 | { |
| 123 | 123 | return $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:text', $text); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | - * Create and return an xsl:value-of element |
|
| 128 | - * |
|
| 129 | - * @param string $select XPath expression for the "select" attribute |
|
| 130 | - * @return Element |
|
| 131 | - */ |
|
| 127 | + * Create and return an xsl:value-of element |
|
| 128 | + * |
|
| 129 | + * @param string $select XPath expression for the "select" attribute |
|
| 130 | + * @return Element |
|
| 131 | + */ |
|
| 132 | 132 | public function createXslValueOf(string $select): Element |
| 133 | 133 | { |
| 134 | 134 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:value-of'); |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | - * Create and return an xsl:variable element |
|
| 142 | - * |
|
| 143 | - * @param string $name Name of the variable |
|
| 144 | - * @param string $select XPath expression |
|
| 145 | - * @return Element |
|
| 146 | - */ |
|
| 141 | + * Create and return an xsl:variable element |
|
| 142 | + * |
|
| 143 | + * @param string $name Name of the variable |
|
| 144 | + * @param string $select XPath expression |
|
| 145 | + * @return Element |
|
| 146 | + */ |
|
| 147 | 147 | public function createXslVariable(string $name, string $select = null): Element |
| 148 | 148 | { |
| 149 | 149 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:variable'); |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | - * Create and return an xsl:when element |
|
| 161 | - * |
|
| 162 | - * @param string $test XPath expression for the "test" attribute |
|
| 163 | - * @return Element |
|
| 164 | - */ |
|
| 160 | + * Create and return an xsl:when element |
|
| 161 | + * |
|
| 162 | + * @param string $test XPath expression for the "test" attribute |
|
| 163 | + * @return Element |
|
| 164 | + */ |
|
| 165 | 165 | public function createXslWhen(string $test): Element |
| 166 | 166 | { |
| 167 | 167 | $element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:when'); |
@@ -171,39 +171,39 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Evaluate and return the result of a given XPath expression |
|
| 175 | - * |
|
| 176 | - * @param string $expr XPath expression |
|
| 177 | - * @param DOMNode $node Context node |
|
| 178 | - * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 179 | - * @return mixed |
|
| 180 | - */ |
|
| 174 | + * Evaluate and return the result of a given XPath expression |
|
| 175 | + * |
|
| 176 | + * @param string $expr XPath expression |
|
| 177 | + * @param DOMNode $node Context node |
|
| 178 | + * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 179 | + * @return mixed |
|
| 180 | + */ |
|
| 181 | 181 | public function evaluate(string $expr, DOMNode $node = null, bool $registerNodeNS = true) |
| 182 | 182 | { |
| 183 | 183 | return call_user_func_array([$this->xpath(), 'evaluate'], func_get_args()); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | - * Evaluate and return the first element of a given XPath query |
|
| 188 | - * |
|
| 189 | - * @param string $expr XPath expression |
|
| 190 | - * @param DOMNode $node Context node |
|
| 191 | - * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 192 | - * @return DOMNode|null |
|
| 193 | - */ |
|
| 187 | + * Evaluate and return the first element of a given XPath query |
|
| 188 | + * |
|
| 189 | + * @param string $expr XPath expression |
|
| 190 | + * @param DOMNode $node Context node |
|
| 191 | + * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 192 | + * @return DOMNode|null |
|
| 193 | + */ |
|
| 194 | 194 | public function firstOf(string $expr, DOMNode $node = null, bool $registerNodeNS = true): ?DOMNode |
| 195 | 195 | { |
| 196 | 196 | return call_user_func_array([$this, 'query'], func_get_args())->item(0); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | - * Evaluate and return the result of a given XPath query |
|
| 201 | - * |
|
| 202 | - * @param string $expr XPath expression |
|
| 203 | - * @param DOMNode $node Context node |
|
| 204 | - * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 205 | - * @return DOMNodeList |
|
| 206 | - */ |
|
| 200 | + * Evaluate and return the result of a given XPath query |
|
| 201 | + * |
|
| 202 | + * @param string $expr XPath expression |
|
| 203 | + * @param DOMNode $node Context node |
|
| 204 | + * @param bool $registerNodeNS Whether to register the node's namespace |
|
| 205 | + * @return DOMNodeList |
|
| 206 | + */ |
|
| 207 | 207 | public function query(string $expr, DOMNode $node = null, bool $registerNodeNS = true): DOMNodeList |
| 208 | 208 | { |
| 209 | 209 | return call_user_func_array([$this->xpath(), 'query'], func_get_args()); |
@@ -29,33 +29,33 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Evaluate and return the result of a given XPath expression using this element as context |
|
| 33 | - * |
|
| 34 | - * @param string $query XPath expression |
|
| 35 | - * @return mixed |
|
| 36 | - */ |
|
| 32 | + * Evaluate and return the result of a given XPath expression using this element as context |
|
| 33 | + * |
|
| 34 | + * @param string $query XPath expression |
|
| 35 | + * @return mixed |
|
| 36 | + */ |
|
| 37 | 37 | public function evaluate(string $query) |
| 38 | 38 | { |
| 39 | 39 | return $this->ownerDocument->evaluate($query, $this); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Evaluate and return the first element of a given XPath query using this element as context |
|
| 44 | - * |
|
| 45 | - * @param string $query XPath expression |
|
| 46 | - * @return mixed |
|
| 47 | - */ |
|
| 43 | + * Evaluate and return the first element of a given XPath query using this element as context |
|
| 44 | + * |
|
| 45 | + * @param string $query XPath expression |
|
| 46 | + * @return mixed |
|
| 47 | + */ |
|
| 48 | 48 | public function firstOf(string $query) |
| 49 | 49 | { |
| 50 | 50 | return $this->ownerDocument->firstOf($query, $this); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * Evaluate and return the result of a given XPath query using this element as context |
|
| 55 | - * |
|
| 56 | - * @param string $query XPath expression |
|
| 57 | - * @return mixed |
|
| 58 | - */ |
|
| 54 | + * Evaluate and return the result of a given XPath query using this element as context |
|
| 55 | + * |
|
| 56 | + * @param string $query XPath expression |
|
| 57 | + * @return mixed |
|
| 58 | + */ |
|
| 59 | 59 | public function query(string $query) |
| 60 | 60 | { |
| 61 | 61 | return $this->ownerDocument->query($query, $this); |