Completed
Push — master ( 4299fd...109652 )
by Josh
01:30
created
src/Element.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
 
165 165
 		return preg_replace_callback(
166 166
 			'(<([-\\w]++):[^>]*?\\K\\s*/?>)',
167
-			function ($m) use ($prefixes)
167
+			function($m) use ($prefixes)
168 168
 			{
169 169
 				$return = $m[0];
170 170
 				$prefix = $m[1];
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -84,45 +84,45 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Evaluate and return the result of a given XPath expression using this element as context node
88
-	*
89
-	* @param  string  $expr XPath expression
90
-	* @return mixed
91
-	*/
87
+	 * Evaluate and return the result of a given XPath expression using this element as context node
88
+	 *
89
+	 * @param  string  $expr XPath expression
90
+	 * @return mixed
91
+	 */
92 92
 	public function evaluate(string $expr)
93 93
 	{
94 94
 		return $this->ownerDocument->evaluate($expr, $this);
95 95
 	}
96 96
 
97 97
 	/**
98
-	* Evaluate and return the first element of a given XPath query using this element as context node
99
-	*
100
-	* @param  string       $expr XPath expression
101
-	* @return DOMNode|null
102
-	*/
98
+	 * Evaluate and return the first element of a given XPath query using this element as context node
99
+	 *
100
+	 * @param  string       $expr XPath expression
101
+	 * @return DOMNode|null
102
+	 */
103 103
 	public function firstOf(string $expr): ?DOMNode
104 104
 	{
105 105
 		return $this->ownerDocument->firstOf($expr, $this);
106 106
 	}
107 107
 
108 108
 	/**
109
-	* Evaluate and return the result of a given XPath query using this element as context node
110
-	*
111
-	* @param  string      $expr XPath expression
112
-	* @return DOMNodeList
113
-	*/
109
+	 * Evaluate and return the result of a given XPath query using this element as context node
110
+	 *
111
+	 * @param  string      $expr XPath expression
112
+	 * @return DOMNodeList
113
+	 */
114 114
 	public function query(string $expr): DOMNodeList
115 115
 	{
116 116
 		return $this->ownerDocument->query($expr, $this);
117 117
 	}
118 118
 
119 119
 	/**
120
-	* Insert given element relative to this element's position
121
-	*
122
-	* @param  string $where   One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
123
-	* @param  self   $element
124
-	* @return self
125
-	*/
120
+	 * Insert given element relative to this element's position
121
+	 *
122
+	 * @param  string $where   One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
123
+	 * @param  self   $element
124
+	 * @return self
125
+	 */
126 126
 	public function insertAdjacentElement(string $where, self $element): self
127 127
 	{
128 128
 		$this->insertAdjacentNode($where, $element);
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	/**
134
-	* Insert given text relative to this element's position
135
-	*
136
-	* @param  string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
137
-	* @param  string $text
138
-	* @return void
139
-	*/
134
+	 * Insert given text relative to this element's position
135
+	 *
136
+	 * @param  string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
137
+	 * @param  string $text
138
+	 * @return void
139
+	 */
140 140
 	public function insertAdjacentText(string $where, string $text): void
141 141
 	{
142 142
 		$this->insertAdjacentXML($where, htmlspecialchars($text, ENT_XML1));
143 143
 	}
144 144
 
145 145
 	/**
146
-	* Insert given XML relative to this element's position
147
-	*
148
-	* @param  string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
149
-	* @param  string $xml
150
-	* @return void
151
-	*/
146
+	 * Insert given XML relative to this element's position
147
+	 *
148
+	 * @param  string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
149
+	 * @param  string $xml
150
+	 * @return void
151
+	 */
152 152
 	public function insertAdjacentXML(string $where, string $xml): void
153 153
 	{
154 154
 		$fragment = $this->ownerDocument->createDocumentFragment();
@@ -158,32 +158,32 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 
160 160
 	/**
161
-	* Remove this element from the document
162
-	*
163
-	* @return self This element
164
-	*/
161
+	 * Remove this element from the document
162
+	 *
163
+	 * @return self This element
164
+	 */
165 165
 	public function remove(): self
166 166
 	{
167 167
 		return $this->parentNode->removeChild($this);
168 168
 	}
169 169
 
170 170
 	/**
171
-	* Replace this element with given element
172
-	*
173
-	* @param  self $element Replacement element
174
-	* @return self          This element
175
-	*/
171
+	 * Replace this element with given element
172
+	 *
173
+	 * @param  self $element Replacement element
174
+	 * @return self          This element
175
+	 */
176 176
 	public function replace(self $element): self
177 177
 	{
178 178
 		return $this->parentNode->replaceChild($element, $this);
179 179
 	}
180 180
 
181 181
 	/**
182
-	* Add namespace declarations that may be missing in given XML
183
-	*
184
-	* @param  string $xml Original XML
185
-	* @return string      Modified XML
186
-	*/
182
+	 * Add namespace declarations that may be missing in given XML
183
+	 *
184
+	 * @param  string $xml Original XML
185
+	 * @return string      Modified XML
186
+	 */
187 187
 	protected function addMissingNamespaceDeclarations(string $xml): string
188 188
 	{
189 189
 		preg_match_all('(xmlns:\\K[-\\w]++(?==))', $xml, $m);
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	}
209 209
 
210 210
 	/**
211
-	* Insert given node relative to this element's position
212
-	*
213
-	* @param  string  $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
214
-	* @param  DOMNode $node
215
-	* @return void
216
-	*/
211
+	 * Insert given node relative to this element's position
212
+	 *
213
+	 * @param  string  $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend'
214
+	 * @param  DOMNode $node
215
+	 * @return void
216
+	 */
217 217
 	protected function insertAdjacentNode(string $where, DOMNode $node): void
218 218
 	{
219 219
 		$where = strtolower($where);
Please login to merge, or discard this patch.
src/Document.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
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
-	*/
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
+	 */
23 23
 	public function __construct(string $version = '1.0', string $encoding = 'utf-8')
24 24
 	{
25 25
 		parent::__construct($version, $encoding);
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	/**
31
-	* Create and return an xsl:apply-templates element
32
-	*
33
-	* @param  string  $select XPath expression for the "select" attribute
34
-	* @return Element
35
-	*/
31
+	 * Create and return an xsl:apply-templates element
32
+	 *
33
+	 * @param  string  $select XPath expression for the "select" attribute
34
+	 * @return Element
35
+	 */
36 36
 	public function createXslApplyTemplates(string $select = null): Element
37 37
 	{
38 38
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:apply-templates');
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	/**
48
-	* Create and return an xsl:attribute element
49
-	*
50
-	* @param  string  $name Attribute's name
51
-	* @param  string  $text Text content for the element
52
-	* @return Element
53
-	*/
48
+	 * Create and return an xsl:attribute element
49
+	 *
50
+	 * @param  string  $name Attribute's name
51
+	 * @param  string  $text Text content for the element
52
+	 * @return Element
53
+	 */
54 54
 	public function createXslAttribute(string $name, string $text = ''): Element
55 55
 	{
56 56
 		$element = $this->createElementNS(
@@ -64,21 +64,21 @@  discard block
 block discarded – undo
64 64
 	}
65 65
 
66 66
 	/**
67
-	* Create and return an xsl:choose element
68
-	*
69
-	* @return Element
70
-	*/
67
+	 * Create and return an xsl:choose element
68
+	 *
69
+	 * @return Element
70
+	 */
71 71
 	public function createXslChoose(): Element
72 72
 	{
73 73
 		return $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:choose');
74 74
 	}
75 75
 
76 76
 	/**
77
-	* Create and return an xsl:comment element
78
-	*
79
-	* @param  string  $text Text content for the comment
80
-	* @return Element
81
-	*/
77
+	 * Create and return an xsl:comment element
78
+	 *
79
+	 * @param  string  $text Text content for the comment
80
+	 * @return Element
81
+	 */
82 82
 	public function createXslComment(string $text = ''): Element
83 83
 	{
84 84
 		return $this->createElementNS(
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	/**
92
-	* Create and return an xsl:copy-of element
93
-	*
94
-	* @param  string  $select XPath expression for the "select" attribute
95
-	* @return Element
96
-	*/
92
+	 * Create and return an xsl:copy-of element
93
+	 *
94
+	 * @param  string  $select XPath expression for the "select" attribute
95
+	 * @return Element
96
+	 */
97 97
 	public function createXslCopyOf(string $select): Element
98 98
 	{
99 99
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:copy-of');
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 	/**
106
-	* Create and return an xsl:if element
107
-	*
108
-	* @param  string  $test XPath expression for the "test" attribute
109
-	* @return Element
110
-	*/
106
+	 * Create and return an xsl:if element
107
+	 *
108
+	 * @param  string  $test XPath expression for the "test" attribute
109
+	 * @return Element
110
+	 */
111 111
 	public function createXslIf(string $test): Element
112 112
 	{
113 113
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:if');
@@ -117,21 +117,21 @@  discard block
 block discarded – undo
117 117
 	}
118 118
 
119 119
 	/**
120
-	* Create and return an xsl:otherwise element
121
-	*
122
-	* @return Element
123
-	*/
120
+	 * Create and return an xsl:otherwise element
121
+	 *
122
+	 * @return Element
123
+	 */
124 124
 	public function createXslOtherwise(): Element
125 125
 	{
126 126
 		return $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:otherwise');
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Create and return an xsl:text element
131
-	*
132
-	* @param  string  $text Text content for the element
133
-	* @return Element
134
-	*/
130
+	 * Create and return an xsl:text element
131
+	 *
132
+	 * @param  string  $text Text content for the element
133
+	 * @return Element
134
+	 */
135 135
 	public function createXslText(string $text = ''): Element
136 136
 	{
137 137
 		return $this->createElementNS(
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	/**
145
-	* Create and return an xsl:value-of element
146
-	*
147
-	* @param  string  $select XPath expression for the "select" attribute
148
-	* @return Element
149
-	*/
145
+	 * Create and return an xsl:value-of element
146
+	 *
147
+	 * @param  string  $select XPath expression for the "select" attribute
148
+	 * @return Element
149
+	 */
150 150
 	public function createXslValueOf(string $select): Element
151 151
 	{
152 152
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:value-of');
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 	}
157 157
 
158 158
 	/**
159
-	* Create and return an xsl:variable element
160
-	*
161
-	* @param  string  $name   Name of the variable
162
-	* @param  string  $select XPath expression
163
-	* @return Element
164
-	*/
159
+	 * Create and return an xsl:variable element
160
+	 *
161
+	 * @param  string  $name   Name of the variable
162
+	 * @param  string  $select XPath expression
163
+	 * @return Element
164
+	 */
165 165
 	public function createXslVariable(string $name, string $select = null): Element
166 166
 	{
167 167
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:variable');
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	/**
178
-	* Create and return an xsl:when element
179
-	*
180
-	* @param  string  $test XPath expression for the "test" attribute
181
-	* @return Element
182
-	*/
178
+	 * Create and return an xsl:when element
179
+	 *
180
+	 * @param  string  $test XPath expression for the "test" attribute
181
+	 * @return Element
182
+	 */
183 183
 	public function createXslWhen(string $test): Element
184 184
 	{
185 185
 		$element = $this->createElementNS('http://www.w3.org/1999/XSL/Transform', 'xsl:when');
@@ -189,51 +189,51 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Evaluate and return the result of a given XPath expression
193
-	*
194
-	* @param  string  $expr           XPath expression
195
-	* @param  DOMNode $node           Context node
196
-	* @param  bool    $registerNodeNS Whether to register the node's namespace
197
-	* @return mixed
198
-	*/
192
+	 * Evaluate and return the result of a given XPath expression
193
+	 *
194
+	 * @param  string  $expr           XPath expression
195
+	 * @param  DOMNode $node           Context node
196
+	 * @param  bool    $registerNodeNS Whether to register the node's namespace
197
+	 * @return mixed
198
+	 */
199 199
 	public function evaluate(string $expr, DOMNode $node = null, bool $registerNodeNS = true)
200 200
 	{
201 201
 		return $this->xpath('evaluate', func_get_args());
202 202
 	}
203 203
 
204 204
 	/**
205
-	* Evaluate and return the first element of a given XPath query
206
-	*
207
-	* @param  string      $expr           XPath expression
208
-	* @param  DOMNode     $node           Context node
209
-	* @param  bool        $registerNodeNS Whether to register the node's namespace
210
-	* @return DOMNode|null
211
-	*/
205
+	 * Evaluate and return the first element of a given XPath query
206
+	 *
207
+	 * @param  string      $expr           XPath expression
208
+	 * @param  DOMNode     $node           Context node
209
+	 * @param  bool        $registerNodeNS Whether to register the node's namespace
210
+	 * @return DOMNode|null
211
+	 */
212 212
 	public function firstOf(string $expr, DOMNode $node = null, bool $registerNodeNS = true): ?DOMNode
213 213
 	{
214 214
 		return $this->xpath('query', func_get_args())->item(0);
215 215
 	}
216 216
 
217 217
 	/**
218
-	* Evaluate and return the result of a given XPath query
219
-	*
220
-	* @param  string      $expr           XPath expression
221
-	* @param  DOMNode     $node           Context node
222
-	* @param  bool        $registerNodeNS Whether to register the node's namespace
223
-	* @return DOMNodeList
224
-	*/
218
+	 * Evaluate and return the result of a given XPath query
219
+	 *
220
+	 * @param  string      $expr           XPath expression
221
+	 * @param  DOMNode     $node           Context node
222
+	 * @param  bool        $registerNodeNS Whether to register the node's namespace
223
+	 * @return DOMNodeList
224
+	 */
225 225
 	public function query(string $expr, DOMNode $node = null, bool $registerNodeNS = true): DOMNodeList
226 226
 	{
227 227
 		return $this->xpath('query', func_get_args());
228 228
 	}
229 229
 
230 230
 	/**
231
-	* Execute a DOMXPath method and return the result
232
-	*
233
-	* @param  string $methodName
234
-	* @param  array  $args
235
-	* @return mixed
236
-	*/
231
+	 * Execute a DOMXPath method and return the result
232
+	 *
233
+	 * @param  string $methodName
234
+	 * @param  array  $args
235
+	 * @return mixed
236
+	 */
237 237
 	protected function xpath(string $methodName, array $args)
238 238
 	{
239 239
 		$xpath = new DOMXPath($this);
Please login to merge, or discard this patch.