Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 038517...a4d91e )
by Der Mundschenk
05:27 queued 02:53
created
src/settings/class-dash-style.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	 * @param string   $style    The dash style.
111 111
 	 * @param Settings $settings The current settings.
112 112
 	 *
113
-	 * @return Dashes|null Returns null in case of an invalid $style parameter.
113
+	 * @return Simple_Dashes|null Returns null in case of an invalid $style parameter.
114 114
 	 */
115 115
 	public static function get_styled_dashes( $style, Settings $settings ) {
116 116
 		if ( isset( self::$styles[ $style ] ) ) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * "International" dash style (using en dashes).
48 48
 	 */
49
-	const INTERNATIONAL  = 'international';
49
+	const INTERNATIONAL = 'international';
50 50
 
51 51
 	/**
52 52
 	 * Available dash styles.
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return Dashes|null Returns null in case of an invalid $style parameter.
114 114
 	 */
115
-	public static function get_styled_dashes( $style, Settings $settings ) {
116
-		if ( isset( self::$styles[ $style ] ) ) {
115
+	public static function get_styled_dashes($style, Settings $settings) {
116
+		if (isset(self::$styles[$style])) {
117 117
 			return new Simple_Dashes(
118
-				self::$styles[ $style ][ self::_PARENTHETICAL ],
119
-				self::$styles[ $style ][ self::_PARENTHETICAL_SPACE ],
120
-				self::$styles[ $style ][ self::_INTERVAL ],
121
-				self::$styles[ $style ][ self::_INTERVAL_SPACE ]
118
+				self::$styles[$style][self::_PARENTHETICAL],
119
+				self::$styles[$style][self::_PARENTHETICAL_SPACE],
120
+				self::$styles[$style][self::_INTERVAL],
121
+				self::$styles[$style][self::_INTERVAL_SPACE]
122 122
 			);
123 123
 		}
124 124
 
Please login to merge, or discard this patch.
src/hyphenator/class-trie-node.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return Trie_Node
69 69
 	 */
70
-	public function get_node( $char ) {
71
-		if ( ! isset( $this->links[ $char ] ) ) {
72
-			$this->links[ $char ] = new Trie_Node();
70
+	public function get_node($char) {
71
+		if ( ! isset($this->links[$char])) {
72
+			$this->links[$char] = new Trie_Node();
73 73
 		}
74 74
 
75
-		return $this->links[ $char ];
75
+		return $this->links[$char];
76 76
 	}
77 77
 
78 78
 	/**
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @return bool
84 84
 	 */
85
-	public function exists( $char ) {
86
-		return ! empty( $this->links[ $char ] );
85
+	public function exists($char) {
86
+		return ! empty($this->links[$char]);
87 87
 	}
88 88
 
89 89
 	/**
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return Trie_Node The starting node of the trie.
104 104
 	 */
105
-	public static function build_trie( array $patterns ) {
105
+	public static function build_trie(array $patterns) {
106 106
 		$trie = new Trie_Node();
107 107
 
108
-		foreach ( $patterns as $key => $pattern ) {
108
+		foreach ($patterns as $key => $pattern) {
109 109
 			$node = $trie;
110 110
 
111
-			foreach ( Strings::mb_str_split( $key ) as $char ) {
112
-				$node = $node->get_node( $char );
111
+			foreach (Strings::mb_str_split($key) as $char) {
112
+				$node = $node->get_node($char);
113 113
 			}
114 114
 
115
-			preg_match_all( '/([1-9])/S', $pattern, $offsets, PREG_OFFSET_CAPTURE );
115
+			preg_match_all('/([1-9])/S', $pattern, $offsets, PREG_OFFSET_CAPTURE);
116 116
 			$node->offsets = $offsets[1];
117 117
 		}
118 118
 
Please login to merge, or discard this patch.
src/class-hyphenator-cache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string     $lang       A language code.
49 49
 	 * @param Hyphenator $hyphenator The object to cache.
50 50
 	 */
51
-	public function set_hyphenator( $lang, Hyphenator $hyphenator ) {
52
-		$this->cache[ $lang ] = $hyphenator;
51
+	public function set_hyphenator($lang, Hyphenator $hyphenator) {
52
+		$this->cache[$lang] = $hyphenator;
53 53
 	}
54 54
 
55 55
 	/**
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return Hyphenator|null
61 61
 	 */
62
-	public function get_hyphenator( $lang ) {
63
-		if ( isset( $this->cache[ $lang ] ) ) {
64
-			return $this->cache[ $lang ];
62
+	public function get_hyphenator($lang) {
63
+		if (isset($this->cache[$lang])) {
64
+			return $this->cache[$lang];
65 65
 		}
66 66
 
67 67
 		return null;
Please login to merge, or discard this patch.
src/class-php-typography.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	const SPACING_POST_WORDS = 40;
54 54
 	const HTML_INSERTION     = 50;
55 55
 
56
-	const GROUPS = [ self::CHARACTERS, self::SPACING_PRE_WORDS, self::PROCESS_WORDS, self::SPACING_POST_WORDS, self::HTML_INSERTION ];
56
+	const GROUPS = [self::CHARACTERS, self::SPACING_PRE_WORDS, self::PROCESS_WORDS, self::SPACING_POST_WORDS, self::HTML_INSERTION];
57 57
 
58 58
 	/**
59 59
 	 * A DOM-based HTML5 parser.
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @var string
116 116
 	 */
117
-	const INIT_NOW  = 'now';
117
+	const INIT_NOW = 'now';
118 118
 
119 119
 	/**
120 120
 	 * Constant for signalling lazy (manual) initialization to the constructor.
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @param string $init Optional. Flag to control initialization. Valid inputs are INIT_NOW and INIT_LAZY. Default INIT_NOW.
130 130
 	 */
131
-	public function __construct( $init = self::INIT_NOW ) {
132
-		if ( self::INIT_NOW === $init ) {
131
+	public function __construct($init = self::INIT_NOW) {
132
+		if (self::INIT_NOW === $init) {
133 133
 			$this->init();
134 134
 		}
135 135
 	}
@@ -141,46 +141,46 @@  discard block
 block discarded – undo
141 141
 		$this->process_words_fix = new Node_Fixes\Process_Words_Fix();
142 142
 
143 143
 		// Nodify anything that requires adjacent text awareness here.
144
-		$this->register_node_fix( new Node_Fixes\Smart_Maths_Fix(),          self::CHARACTERS );
145
-		$this->register_node_fix( new Node_Fixes\Smart_Diacritics_Fix(),     self::CHARACTERS );
146
-		$this->register_node_fix( new Node_Fixes\Smart_Quotes_Fix( true ),   self::CHARACTERS );
147
-		$this->register_node_fix( new Node_Fixes\Smart_Dashes_Fix( true ),   self::CHARACTERS );
148
-		$this->register_node_fix( new Node_Fixes\Smart_Ellipses_Fix( true ), self::CHARACTERS );
149
-		$this->register_node_fix( new Node_Fixes\Smart_Marks_Fix( true ),    self::CHARACTERS );
144
+		$this->register_node_fix(new Node_Fixes\Smart_Maths_Fix(), self::CHARACTERS);
145
+		$this->register_node_fix(new Node_Fixes\Smart_Diacritics_Fix(), self::CHARACTERS);
146
+		$this->register_node_fix(new Node_Fixes\Smart_Quotes_Fix(true), self::CHARACTERS);
147
+		$this->register_node_fix(new Node_Fixes\Smart_Dashes_Fix(true), self::CHARACTERS);
148
+		$this->register_node_fix(new Node_Fixes\Smart_Ellipses_Fix(true), self::CHARACTERS);
149
+		$this->register_node_fix(new Node_Fixes\Smart_Marks_Fix(true), self::CHARACTERS);
150 150
 
151 151
 		// Keep spacing after smart character replacement.
152
-		$this->register_node_fix( new Node_Fixes\Single_Character_Word_Spacing_Fix(), self::SPACING_PRE_WORDS );
153
-		$this->register_node_fix( new Node_Fixes\Dash_Spacing_Fix(),                  self::SPACING_PRE_WORDS );
154
-		$this->register_node_fix( new Node_Fixes\Unit_Spacing_Fix(),                  self::SPACING_PRE_WORDS );
155
-		$this->register_node_fix( new Node_Fixes\Numbered_Abbreviation_Spacing_Fix(), self::SPACING_PRE_WORDS );
156
-		$this->register_node_fix( new Node_Fixes\French_Punctuation_Spacing_Fix(),    self::SPACING_PRE_WORDS );
152
+		$this->register_node_fix(new Node_Fixes\Single_Character_Word_Spacing_Fix(), self::SPACING_PRE_WORDS);
153
+		$this->register_node_fix(new Node_Fixes\Dash_Spacing_Fix(), self::SPACING_PRE_WORDS);
154
+		$this->register_node_fix(new Node_Fixes\Unit_Spacing_Fix(), self::SPACING_PRE_WORDS);
155
+		$this->register_node_fix(new Node_Fixes\Numbered_Abbreviation_Spacing_Fix(), self::SPACING_PRE_WORDS);
156
+		$this->register_node_fix(new Node_Fixes\French_Punctuation_Spacing_Fix(), self::SPACING_PRE_WORDS);
157 157
 
158 158
 		// Parse and process individual words.
159
-		$this->register_node_fix( $this->process_words_fix, self::PROCESS_WORDS );
159
+		$this->register_node_fix($this->process_words_fix, self::PROCESS_WORDS);
160 160
 
161 161
 		// Some final space manipulation.
162
-		$this->register_node_fix( new Node_Fixes\Dewidow_Fix(),        self::SPACING_POST_WORDS );
163
-		$this->register_node_fix( new Node_Fixes\Space_Collapse_Fix(), self::SPACING_POST_WORDS );
162
+		$this->register_node_fix(new Node_Fixes\Dewidow_Fix(), self::SPACING_POST_WORDS);
163
+		$this->register_node_fix(new Node_Fixes\Space_Collapse_Fix(), self::SPACING_POST_WORDS);
164 164
 
165 165
 		// Everything that requires HTML injection occurs here (functions above assume tag-free content)
166 166
 		// pay careful attention to functions below for tolerance of injected tags.
167
-		$this->register_node_fix( new Node_Fixes\Smart_Ordinal_Suffix_Fix( $this->css_classes['ordinal'] ),                                 self::HTML_INSERTION ); // call before "style_numbers" and "smart_fractions".
168
-		$this->register_node_fix( new Node_Fixes\Smart_Exponents_Fix(),                                                                     self::HTML_INSERTION ); // call before "style_numbers".
169
-		$this->register_node_fix( new Node_Fixes\Smart_Fractions_Fix( $this->css_classes['numerator'], $this->css_classes['denominator'] ), self::HTML_INSERTION ); // call before "style_numbers" and after "smart_ordinal_suffix".
170
-		$this->register_node_fix( new Node_Fixes\Style_Caps_Fix( $this->css_classes['caps'] ),                                              self::HTML_INSERTION ); // Call before "style_numbers".
171
-		$this->register_node_fix( new Node_Fixes\Style_Numbers_Fix( $this->css_classes['numbers'] ),                                        self::HTML_INSERTION ); // Call after "smart_ordinal_suffix", "smart_exponents", "smart_fractions", and "style_caps".
172
-		$this->register_node_fix( new Node_Fixes\Style_Ampersands_Fix( $this->css_classes['amp'] ),                                         self::HTML_INSERTION );
173
-		$this->register_node_fix( new Node_Fixes\Style_Initial_Quotes_Fix( $this->css_classes['quo'], $this->css_classes['dquo'] ),         self::HTML_INSERTION );
174
-		$this->register_node_fix( new Node_Fixes\Style_Hanging_Punctuation_Fix( $this->css_classes['push-single'], $this->css_classes['push-double'], $this->css_classes['pull-single'], $this->css_classes['pull-double'] ), self::HTML_INSERTION );
167
+		$this->register_node_fix(new Node_Fixes\Smart_Ordinal_Suffix_Fix($this->css_classes['ordinal']), self::HTML_INSERTION); // call before "style_numbers" and "smart_fractions".
168
+		$this->register_node_fix(new Node_Fixes\Smart_Exponents_Fix(), self::HTML_INSERTION); // call before "style_numbers".
169
+		$this->register_node_fix(new Node_Fixes\Smart_Fractions_Fix($this->css_classes['numerator'], $this->css_classes['denominator']), self::HTML_INSERTION); // call before "style_numbers" and after "smart_ordinal_suffix".
170
+		$this->register_node_fix(new Node_Fixes\Style_Caps_Fix($this->css_classes['caps']), self::HTML_INSERTION); // Call before "style_numbers".
171
+		$this->register_node_fix(new Node_Fixes\Style_Numbers_Fix($this->css_classes['numbers']), self::HTML_INSERTION); // Call after "smart_ordinal_suffix", "smart_exponents", "smart_fractions", and "style_caps".
172
+		$this->register_node_fix(new Node_Fixes\Style_Ampersands_Fix($this->css_classes['amp']), self::HTML_INSERTION);
173
+		$this->register_node_fix(new Node_Fixes\Style_Initial_Quotes_Fix($this->css_classes['quo'], $this->css_classes['dquo']), self::HTML_INSERTION);
174
+		$this->register_node_fix(new Node_Fixes\Style_Hanging_Punctuation_Fix($this->css_classes['push-single'], $this->css_classes['push-double'], $this->css_classes['pull-single'], $this->css_classes['pull-double']), self::HTML_INSERTION);
175 175
 
176 176
 		// Register token fixes.
177 177
 		$cache = $this->get_hyphenator_cache();
178 178
 
179
-		$this->register_token_fix( new Token_Fixes\Wrap_Hard_Hyphens_Fix() );
180
-		$this->register_token_fix( new Token_Fixes\Hyphenate_Compounds_Fix( $cache ) );
181
-		$this->register_token_fix( new Token_Fixes\Hyphenate_Fix( $cache ) );
182
-		$this->register_token_fix( new Token_Fixes\Wrap_URLs_Fix( $cache ) );
183
-		$this->register_token_fix( new Token_Fixes\Wrap_Emails_Fix() );
179
+		$this->register_token_fix(new Token_Fixes\Wrap_Hard_Hyphens_Fix());
180
+		$this->register_token_fix(new Token_Fixes\Hyphenate_Compounds_Fix($cache));
181
+		$this->register_token_fix(new Token_Fixes\Hyphenate_Fix($cache));
182
+		$this->register_token_fix(new Token_Fixes\Wrap_URLs_Fix($cache));
183
+		$this->register_token_fix(new Token_Fixes\Wrap_Emails_Fix());
184 184
 	}
185 185
 
186 186
 	/**
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string The processed $html.
194 194
 	 */
195
-	public function process( $html, Settings $settings, $is_title = false ) {
196
-		return $this->process_textnodes( $html, [ $this, 'apply_fixes_to_html_node' ], $settings, $is_title );
195
+	public function process($html, Settings $settings, $is_title = false) {
196
+		return $this->process_textnodes($html, [$this, 'apply_fixes_to_html_node'], $settings, $is_title);
197 197
 	}
198 198
 
199 199
 	/**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return string The processed $html.
208 208
 	 */
209
-	public function process_feed( $html, Settings $settings, $is_title = false ) {
210
-		return $this->process_textnodes( $html, [ $this, 'apply_fixes_to_feed_node' ], $settings, $is_title );
209
+	public function process_feed($html, Settings $settings, $is_title = false) {
210
+		return $this->process_textnodes($html, [$this, 'apply_fixes_to_feed_node'], $settings, $is_title);
211 211
 	}
212 212
 
213 213
 	/**
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string The processed $html.
222 222
 	 */
223
-	public function process_textnodes( $html, $fixer, Settings $settings, $is_title = false ) {
223
+	public function process_textnodes($html, $fixer, Settings $settings, $is_title = false) {
224 224
 		// Don't do aynthing if there is no valid callback.
225
-		if ( ! is_callable( $fixer ) ) {
226
-			trigger_error( 'PHP_Typography::process_textnodes called without a valid callback.', E_USER_WARNING ); // @codingStandardsIgnoreLine
225
+		if ( ! is_callable($fixer)) {
226
+			trigger_error('PHP_Typography::process_textnodes called without a valid callback.', E_USER_WARNING); // @codingStandardsIgnoreLine
227 227
 			return $html;
228 228
 		}
229 229
 
230
-		if ( isset( $settings['ignoreTags'] ) && $is_title && ( in_array( 'h1', $settings['ignoreTags'], true ) || in_array( 'h2', $settings['ignoreTags'], true ) ) ) {
230
+		if (isset($settings['ignoreTags']) && $is_title && (in_array('h1', $settings['ignoreTags'], true) || in_array('h2', $settings['ignoreTags'], true))) {
231 231
 			return $html;
232 232
 		}
233 233
 
@@ -235,41 +235,41 @@  discard block
 block discarded – undo
235 235
 		$html5_parser = $this->get_html5_parser();
236 236
 
237 237
 		// Parse the HTML.
238
-		$dom = $this->parse_html( $html5_parser, $html, $settings );
238
+		$dom = $this->parse_html($html5_parser, $html, $settings);
239 239
 
240 240
 		// Abort if there were parsing errors.
241
-		if ( empty( $dom ) ) {
241
+		if (empty($dom)) {
242 242
 			return $html;
243 243
 		}
244 244
 
245 245
 		// Query some nodes in the DOM.
246
-		$xpath = new \DOMXPath( $dom );
247
-		$body_node = $xpath->query( '/html/body' )->item( 0 );
248
-		$all_textnodes = $xpath->query( '//text()', $body_node );
249
-		$tags_to_ignore = $this->query_tags_to_ignore( $xpath, $body_node, $settings );
246
+		$xpath = new \DOMXPath($dom);
247
+		$body_node = $xpath->query('/html/body')->item(0);
248
+		$all_textnodes = $xpath->query('//text()', $body_node);
249
+		$tags_to_ignore = $this->query_tags_to_ignore($xpath, $body_node, $settings);
250 250
 
251 251
 		// Start processing.
252
-		foreach ( $all_textnodes as $textnode ) {
253
-			if ( self::arrays_intersect( DOM::get_ancestors( $textnode ), $tags_to_ignore ) ) {
252
+		foreach ($all_textnodes as $textnode) {
253
+			if (self::arrays_intersect(DOM::get_ancestors($textnode), $tags_to_ignore)) {
254 254
 				continue;
255 255
 			}
256 256
 
257 257
 			// We won't be doing anything with spaces, so we can jump ship if that is all we have.
258
-			if ( $textnode->isWhitespaceInElementContent() ) {
258
+			if ($textnode->isWhitespaceInElementContent()) {
259 259
 				continue;
260 260
 			}
261 261
 
262 262
 			// Decode all characters except < > &.
263
-			$textnode->data = htmlspecialchars( $textnode->data, ENT_NOQUOTES, 'UTF-8' ); // returns < > & to encoded HTML characters (&lt; &gt; and &amp; respectively).
263
+			$textnode->data = htmlspecialchars($textnode->data, ENT_NOQUOTES, 'UTF-8'); // returns < > & to encoded HTML characters (&lt; &gt; and &amp; respectively).
264 264
 
265 265
 			// Apply fixes.
266
-			call_user_func( $fixer, $textnode, $settings, $is_title );
266
+			call_user_func($fixer, $textnode, $settings, $is_title);
267 267
 
268 268
 			// Until now, we've only been working on a textnode: HTMLify result.
269
-			$this->replace_node_with_html( $textnode, $textnode->data );
269
+			$this->replace_node_with_html($textnode, $textnode->data);
270 270
 		}
271 271
 
272
-		return $html5_parser->saveHTML( $body_node->childNodes );
272
+		return $html5_parser->saveHTML($body_node->childNodes);
273 273
 	}
274 274
 
275 275
 	/**
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return boolean
283 283
 	 */
284
-	protected static function arrays_intersect( array $array1, array $array2 ) {
285
-		foreach ( $array1 as $value ) {
286
-			if ( isset( $array2[ spl_object_hash( $value ) ] ) ) {
284
+	protected static function arrays_intersect(array $array1, array $array2) {
285
+		foreach ($array1 as $value) {
286
+			if (isset($array2[spl_object_hash($value)])) {
287 287
 				return true;
288 288
 			}
289 289
 		}
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 * @param Settings $settings The settings to apply.
299 299
 	 * @param bool     $is_title Optional. Default false.
300 300
 	 */
301
-	protected function apply_fixes_to_html_node( \DOMText $textnode, Settings $settings, $is_title = false ) {
302
-		foreach ( self::GROUPS as $group ) {
303
-			foreach ( $this->node_fixes[ $group ] as $fix ) {
304
-				$fix->apply( $textnode, $settings, $is_title );
301
+	protected function apply_fixes_to_html_node(\DOMText $textnode, Settings $settings, $is_title = false) {
302
+		foreach (self::GROUPS as $group) {
303
+			foreach ($this->node_fixes[$group] as $fix) {
304
+				$fix->apply($textnode, $settings, $is_title);
305 305
 			}
306 306
 		}
307 307
 	}
@@ -313,11 +313,11 @@  discard block
 block discarded – undo
313 313
 	 * @param Settings $settings The settings to apply.
314 314
 	 * @param bool     $is_title Optional. Default false.
315 315
 	 */
316
-	protected function apply_fixes_to_feed_node( \DOMText $textnode, Settings $settings, $is_title = false ) {
317
-		foreach ( self::GROUPS as $group ) {
318
-			foreach ( $this->node_fixes[ $group ] as $fix ) {
319
-				if ( $fix->feed_compatible() ) {
320
-					$fix->apply( $textnode, $settings, $is_title );
316
+	protected function apply_fixes_to_feed_node(\DOMText $textnode, Settings $settings, $is_title = false) {
317
+		foreach (self::GROUPS as $group) {
318
+			foreach ($this->node_fixes[$group] as $fix) {
319
+				if ($fix->feed_compatible()) {
320
+					$fix->apply($textnode, $settings, $is_title);
321 321
 				}
322 322
 			}
323 323
 		}
@@ -332,28 +332,28 @@  discard block
 block discarded – undo
332 332
 	 *
333 333
 	 * @return \DOMDocument The encoding has already been set to UTF-8. Returns null if there were parsing errors.
334 334
 	 */
335
-	public function parse_html( \Masterminds\HTML5 $parser, $html, Settings $settings ) {
335
+	public function parse_html(\Masterminds\HTML5 $parser, $html, Settings $settings) {
336 336
 		// Silence some parsing errors for invalid HTML.
337
-		set_error_handler( [ $this, 'handle_parsing_errors' ] ); // @codingStandardsIgnoreLine
338
-		$xml_error_handling = libxml_use_internal_errors( true );
337
+		set_error_handler([$this, 'handle_parsing_errors']); // @codingStandardsIgnoreLine
338
+		$xml_error_handling = libxml_use_internal_errors(true);
339 339
 
340 340
 		// Do the actual parsing.
341
-		$dom = $parser->loadHTML( '<!DOCTYPE html><html><body>' . $html . '</body></html>' );
341
+		$dom = $parser->loadHTML('<!DOCTYPE html><html><body>' . $html . '</body></html>');
342 342
 		$dom->encoding = 'UTF-8';
343 343
 
344 344
 		// Restore original error handling.
345 345
 		libxml_clear_errors();
346
-		libxml_use_internal_errors( $xml_error_handling );
346
+		libxml_use_internal_errors($xml_error_handling);
347 347
 		restore_error_handler();
348 348
 
349 349
 		// Handle any parser errors.
350 350
 		$errors = $parser->getErrors();
351
-		if ( ! empty( $settings['parserErrorsHandler'] ) && ! empty( $errors ) ) {
352
-			$errors = call_user_func( $settings['parserErrorsHandler'], $errors );
351
+		if ( ! empty($settings['parserErrorsHandler']) && ! empty($errors)) {
352
+			$errors = call_user_func($settings['parserErrorsHandler'], $errors);
353 353
 		}
354 354
 
355 355
 		// Return null if there are still unhandled parsing errors.
356
-		if ( ! empty( $errors ) && ! $settings['parserErrorsIgnore'] ) {
356
+		if ( ! empty($errors) && ! $settings['parserErrorsIgnore']) {
357 357
 			$dom = null;
358 358
 		}
359 359
 
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return boolean Returns true if the error was handled, false otherwise.
373 373
 	 */
374
-	public function handle_parsing_errors( $errno, $errstr, $errfile, $errline, array $errcontext ) {
375
-		if ( ! ( error_reporting() & $errno ) ) { // @codingStandardsIgnoreLine.
374
+	public function handle_parsing_errors($errno, $errstr, $errfile, $errline, array $errcontext) {
375
+		if ( ! (error_reporting() & $errno)) { // @codingStandardsIgnoreLine.
376 376
 			return true; // not interesting.
377 377
 		}
378 378
 
379 379
 		// Ignore warnings from parser & let PHP handle the rest.
380
-		return $errno & E_USER_WARNING && 0 === substr_compare( $errfile, 'DOMTreeBuilder.php', -18 );
380
+		return $errno & E_USER_WARNING && 0 === substr_compare($errfile, 'DOMTreeBuilder.php', -18);
381 381
 	}
382 382
 
383 383
 	/**
@@ -389,25 +389,25 @@  discard block
 block discarded – undo
389 389
 	 *
390 390
 	 * @return array An array of \DOMNode (can be empty).
391 391
 	 */
392
-	public function query_tags_to_ignore( \DOMXPath $xpath, \DOMNode $initial_node, Settings $settings ) {
392
+	public function query_tags_to_ignore(\DOMXPath $xpath, \DOMNode $initial_node, Settings $settings) {
393 393
 		$elements = [];
394 394
 		$query_parts = [];
395
-		if ( ! empty( $settings['ignoreTags'] ) ) {
396
-			$query_parts[] = '//' . implode( ' | //', $settings['ignoreTags'] );
395
+		if ( ! empty($settings['ignoreTags'])) {
396
+			$query_parts[] = '//' . implode(' | //', $settings['ignoreTags']);
397 397
 		}
398
-		if ( ! empty( $settings['ignoreClasses'] ) ) {
399
-			$query_parts[] = "//*[contains(concat(' ', @class, ' '), ' " . implode( " ') or contains(concat(' ', @class, ' '), ' ", $settings['ignoreClasses'] ) . " ')]";
398
+		if ( ! empty($settings['ignoreClasses'])) {
399
+			$query_parts[] = "//*[contains(concat(' ', @class, ' '), ' " . implode(" ') or contains(concat(' ', @class, ' '), ' ", $settings['ignoreClasses']) . " ')]";
400 400
 		}
401
-		if ( ! empty( $settings['ignoreIDs'] ) ) {
402
-			$query_parts[] = '//*[@id=\'' . implode( '\' or @id=\'', $settings['ignoreIDs'] ) . '\']';
401
+		if ( ! empty($settings['ignoreIDs'])) {
402
+			$query_parts[] = '//*[@id=\'' . implode('\' or @id=\'', $settings['ignoreIDs']) . '\']';
403 403
 		}
404 404
 
405
-		if ( ! empty( $query_parts ) ) {
406
-			$ignore_query = implode( ' | ', $query_parts );
405
+		if ( ! empty($query_parts)) {
406
+			$ignore_query = implode(' | ', $query_parts);
407 407
 
408
-			$nodelist = $xpath->query( $ignore_query, $initial_node );
409
-			if ( false !== $nodelist ) {
410
-				$elements = DOM::nodelist_to_array( $nodelist );
408
+			$nodelist = $xpath->query($ignore_query, $initial_node);
409
+			if (false !== $nodelist) {
410
+				$elements = DOM::nodelist_to_array($nodelist);
411 411
 			}
412 412
 		}
413 413
 
@@ -422,25 +422,25 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @return \DOMNode|array An array of \DOMNode containing the new nodes or the old \DOMNode if the replacement failed.
424 424
 	 */
425
-	public function replace_node_with_html( \DOMNode $node, $content ) {
425
+	public function replace_node_with_html(\DOMNode $node, $content) {
426 426
 		$result = $node;
427 427
 
428 428
 		$parent = $node->parentNode;
429
-		if ( empty( $parent ) ) {
429
+		if (empty($parent)) {
430 430
 			return $node; // abort early to save cycles.
431 431
 		}
432 432
 
433
-		set_error_handler( [ $this, 'handle_parsing_errors' ] ); // @codingStandardsIgnoreLine.
433
+		set_error_handler([$this, 'handle_parsing_errors']); // @codingStandardsIgnoreLine.
434 434
 
435
-		$html_fragment = $this->get_html5_parser()->loadHTMLFragment( $content );
436
-		if ( ! empty( $html_fragment ) ) {
437
-			$imported_fragment = $node->ownerDocument->importNode( $html_fragment, true );
435
+		$html_fragment = $this->get_html5_parser()->loadHTMLFragment($content);
436
+		if ( ! empty($html_fragment)) {
437
+			$imported_fragment = $node->ownerDocument->importNode($html_fragment, true);
438 438
 
439
-			if ( ! empty( $imported_fragment ) ) {
439
+			if ( ! empty($imported_fragment)) {
440 440
 				// Save the children of the imported DOMDocumentFragment before replacement.
441
-				$children = DOM::nodelist_to_array( $imported_fragment->childNodes );
441
+				$children = DOM::nodelist_to_array($imported_fragment->childNodes);
442 442
 
443
-				if ( false !== $parent->replaceChild( $imported_fragment, $node ) ) {
443
+				if (false !== $parent->replaceChild($imported_fragment, $node)) {
444 444
 					// Success! We return the saved array of DOMNodes as
445 445
 					// $imported_fragment is just an empty DOMDocumentFragment now.
446 446
 					$result = $children;
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	public function get_html5_parser() {
462 462
 		// Lazy-load HTML5 parser.
463
-		if ( ! isset( $this->html5_parser ) ) {
464
-			$this->html5_parser = new \Masterminds\HTML5( [
463
+		if ( ! isset($this->html5_parser)) {
464
+			$this->html5_parser = new \Masterminds\HTML5([
465 465
 				'disable_html_ns' => true,
466
-			] );
466
+			]);
467 467
 		}
468 468
 
469 469
 		return $this->html5_parser;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 * @return Hyphenator_Cache
476 476
 	 */
477 477
 	public function get_hyphenator_cache() {
478
-		if ( ! isset( $this->hyphenator_cache ) ) {
478
+		if ( ! isset($this->hyphenator_cache)) {
479 479
 			$this->hyphenator_cache = new Hyphenator_Cache();
480 480
 		}
481 481
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @param Hyphenator_Cache $cache A hyphenator cache instance.
489 489
 	 */
490
-	public function set_hyphenator_cache( Hyphenator_Cache $cache ) {
490
+	public function set_hyphenator_cache(Hyphenator_Cache $cache) {
491 491
 		$this->hyphenator_cache = $cache;
492 492
 	}
493 493
 
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @throws \InvalidArgumentException Group is invalid.
503 503
 	 */
504
-	public function register_node_fix( Node_Fix $fix, $group ) {
505
-		switch ( $group ) {
504
+	public function register_node_fix(Node_Fix $fix, $group) {
505
+		switch ($group) {
506 506
 			case self::CHARACTERS:
507 507
 			case self::SPACING_PRE_WORDS:
508 508
 			case self::PROCESS_WORDS: // Used internally.
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 				break;
512 512
 
513 513
 			default:
514
-				throw new \InvalidArgumentException( "Invalid fixer group $group." );
514
+				throw new \InvalidArgumentException("Invalid fixer group $group.");
515 515
 		}
516 516
 
517
-		$this->node_fixes[ $group ][] = $fix;
517
+		$this->node_fixes[$group][] = $fix;
518 518
 	}
519 519
 
520 520
 	/**
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @param Token_Fix $fix Required.
526 526
 	 */
527
-	public function register_token_fix( Token_Fix $fix ) {
528
-		$this->process_words_fix->register_token_fix( $fix );
527
+	public function register_token_fix(Token_Fix $fix) {
528
+		$this->process_words_fix->register_token_fix($fix);
529 529
 	}
530 530
 
531 531
 	/**
@@ -535,27 +535,27 @@  discard block
 block discarded – undo
535 535
 	 *
536 536
 	 * @return array An array in the form ( $language_code => $language_name ).
537 537
 	 */
538
-	private static function get_language_plugin_list( $path ) {
538
+	private static function get_language_plugin_list($path) {
539 539
 		$language_name_pattern = '/"language"\s*:\s*((".+")|(\'.+\'))\s*,/';
540 540
 		$languages = [];
541
-		$handler = opendir( $path );
541
+		$handler = opendir($path);
542 542
 
543 543
 		// Read all files in directory.
544
-		while ( $file = readdir( $handler ) ) {
544
+		while ($file = readdir($handler)) {
545 545
 			// We only want the JSON files.
546
-			if ( '.json' === substr( $file, -5 ) ) {
547
-				$file_content = file_get_contents( $path . $file );
548
-				if ( preg_match( $language_name_pattern, $file_content, $matches ) ) {
549
-					$language_name = substr( $matches[1], 1, -1 );
550
-					$language_code = substr( $file, 0, -5 );
551
-					$languages[ $language_code ] = $language_name;
546
+			if ('.json' === substr($file, -5)) {
547
+				$file_content = file_get_contents($path . $file);
548
+				if (preg_match($language_name_pattern, $file_content, $matches)) {
549
+					$language_name = substr($matches[1], 1, -1);
550
+					$language_code = substr($file, 0, -5);
551
+					$languages[$language_code] = $language_name;
552 552
 				}
553 553
 			}
554 554
 		}
555
-		closedir( $handler );
555
+		closedir($handler);
556 556
 
557 557
 		// Sort translated language names according to current locale.
558
-		asort( $languages );
558
+		asort($languages);
559 559
 
560 560
 		return $languages;
561 561
 	}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 * @return array An array in the form of ( LANG_CODE => LANGUAGE ).
569 569
 	 */
570 570
 	public static function get_hyphenation_languages() {
571
-		return self::get_language_plugin_list( __DIR__ . '/lang/' );
571
+		return self::get_language_plugin_list(__DIR__ . '/lang/');
572 572
 	}
573 573
 
574 574
 	/**
@@ -579,6 +579,6 @@  discard block
 block discarded – undo
579 579
 	 * @return array An array in the form of ( LANG_CODE => LANGUAGE ).
580 580
 	 */
581 581
 	public static function get_diacritic_languages() {
582
-		return self::get_language_plugin_list( __DIR__ . '/diacritics/' );
582
+		return self::get_language_plugin_list(__DIR__ . '/diacritics/');
583 583
 	}
584 584
 }
Please login to merge, or discard this patch.
src/text-parser/class-token.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 * @throws \BadMethodCallException   If the constructor is called twice.
80 80
 	 * @throws \UnexpectedValueException If the type attribute is outside the allowed range.
81 81
 	 */
82
-	public function __construct( $value, $type = self::WORD ) {
83
-		if ( false === $this->mutable ) {
84
-			throw new \BadMethodCallException( 'Constructor called twice.' );
82
+	public function __construct($value, $type = self::WORD) {
83
+		if (false === $this->mutable) {
84
+			throw new \BadMethodCallException('Constructor called twice.');
85 85
 		}
86 86
 
87
-		switch ( $type ) {
87
+		switch ($type) {
88 88
 			case self::SPACE:
89 89
 			case self::PUNCTUATION:
90 90
 			case self::WORD:
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 				break;
94 94
 
95 95
 			default:
96
-				throw new \UnexpectedValueException( "Invalid type $type." );
96
+				throw new \UnexpectedValueException("Invalid type $type.");
97 97
 		}
98 98
 
99
-		if ( ! isset( $value ) || ! is_string( $value ) ) {
100
-			throw new \UnexpectedValueException( 'Value has to be a string.' );
99
+		if ( ! isset($value) || ! is_string($value)) {
100
+			throw new \UnexpectedValueException('Value has to be a string.');
101 101
 		} else {
102
-			$this->value   = $value;
102
+			$this->value = $value;
103 103
 		}
104 104
 
105 105
 		$this->mutable = false;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return mixed
114 114
 	 */
115
-	public function __get( $property ) {
116
-		if ( property_exists( $this, $property ) ) {
115
+	public function __get($property) {
116
+		if (property_exists($this, $property)) {
117 117
 			return $this->$property;
118 118
 		}
119 119
 	}
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @throws \BadMethodCallException The Token class is immutable.
129 129
 	 */
130
-	public function __set( $id, $val ) {
131
-		throw new \BadMethodCallException( 'Object of class Text_Parser\Token is immutable.' );
130
+	public function __set($id, $val) {
131
+		throw new \BadMethodCallException('Object of class Text_Parser\Token is immutable.');
132 132
 	}
133 133
 
134 134
 	/**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @throws \BadMethodCallException The Token class is immutable.
141 141
 	 */
142
-	public function __unset( $id ) {
143
-		throw new \BadMethodCallException( 'Object of class Text_Parser\Token is immutable.' );
142
+	public function __unset($id) {
143
+		throw new \BadMethodCallException('Object of class Text_Parser\Token is immutable.');
144 144
 	}
145 145
 
146 146
 	/**
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return Token
153 153
 	 */
154
-	public function with_value( $value ) {
155
-		if ( $this->value === $value ) {
154
+	public function with_value($value) {
155
+		if ($this->value === $value) {
156 156
 			return $this;
157 157
 		}
158 158
 
Please login to merge, or discard this patch.
src/class-arrays.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	 *
41 41
 	 * @return array
42 42
 	 */
43
-	public static function array_map_assoc( callable $callable, array $array ) {
44
-		return array_column( array_map( $callable, array_keys( $array ), $array ), 1, 0 );
43
+	public static function array_map_assoc(callable $callable, array $array) {
44
+		return array_column(array_map($callable, array_keys($array), $array), 1, 0);
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
src/bin/update-patterns.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,31 +31,31 @@
 block discarded – undo
31 31
 /**
32 32
  * Autoload parser classes
33 33
  */
34
-$autoload = dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php';
35
-if ( file_exists( $autoload ) ) {
34
+$autoload = dirname(dirname(__DIR__)) . '/vendor/autoload.php';
35
+if (file_exists($autoload)) {
36 36
 	require_once $autoload;
37 37
 } else {
38 38
 	// We are a dependency of another project.
39
-	require_once dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/autoload.php';
39
+	require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/autoload.php';
40 40
 }
41 41
 
42
-$target_directory = dirname( __DIR__ ) . '/lang';
43
-$patterns_list    = json_decode( file_get_contents( __DIR__ . '/patterns.json' ), true );
42
+$target_directory = dirname(__DIR__) . '/lang';
43
+$patterns_list    = json_decode(file_get_contents(__DIR__ . '/patterns.json'), true);
44 44
 
45
-foreach ( $patterns_list['list'] as $pattern ) {
45
+foreach ($patterns_list['list'] as $pattern) {
46 46
 	$language = $pattern['name'];
47 47
 	$url      = $pattern['url'];
48 48
 	$filename = $pattern['short'] . '.json';
49 49
 
50
-	$converter = new Pattern_Converter( $url , $language );
50
+	$converter = new Pattern_Converter($url, $language);
51 51
 
52 52
 	echo "Parsing $language TeX file and converting it to lang/$filename ..."; // phpcs: XSS ok.
53 53
 
54 54
 	try {
55 55
 		$json_pattern = $converter->convert();
56
-		file_put_contents( $target_directory . '/' . $filename, $json_pattern );
56
+		file_put_contents($target_directory . '/' . $filename, $json_pattern);
57 57
 		echo " done\n";
58
-	} catch ( \Exception $e ) {
58
+	} catch (\Exception $e) {
59 59
 		echo " error, skipping\n";
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
src/bin/update-iana.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 /**
32 32
  * Autoload parser classes
33 33
  */
34
-$autoload = dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php';
35
-if ( file_exists( $autoload ) ) {
34
+$autoload = dirname(dirname(__DIR__)) . '/vendor/autoload.php';
35
+if (file_exists($autoload)) {
36 36
 	require_once $autoload;
37 37
 } else {
38 38
 	// We are a dependency of another project.
39
-	require_once dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/autoload.php';
39
+	require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/autoload.php';
40 40
 }
41 41
 
42 42
 $source_file = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt';
43
-$target_file = dirname( __DIR__ ) . '/IANA/tlds-alpha-by-domain.txt';
43
+$target_file = dirname(__DIR__) . '/IANA/tlds-alpha-by-domain.txt';
44 44
 
45
-if ( ! file_exists( $source_file ) ) {
46
-	$file_headers = @get_headers( $source_file );
47
-	if ( 'HTTP/1.0 404 Not Found' === $file_headers[0] ) {
45
+if ( ! file_exists($source_file)) {
46
+	$file_headers = @get_headers($source_file);
47
+	if ('HTTP/1.0 404 Not Found' === $file_headers[0]) {
48 48
 		echo "Error: unknown TLD file '{$source_file}'\n"; // xss ok.
49 49
 		die( -3 );
50 50
 	}
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 
53 53
 try {
54 54
 	echo 'Trying to update IANA top-level domain list ...';
55
-	$domain_list = file_get_contents( $source_file );
55
+	$domain_list = file_get_contents($source_file);
56 56
 
57 57
 	// Ensure directory exists.
58
-	if ( ! is_dir( dirname( $target_file ) ) ) {
59
-		mkdir( dirname( $target_file ), 0755, true );
58
+	if ( ! is_dir(dirname($target_file))) {
59
+		mkdir(dirname($target_file), 0755, true);
60 60
 	}
61 61
 
62
-	$file = new \SplFileObject( $target_file, 'w' );
63
-	if ( 0 === $file->fwrite( $domain_list ) ) {
62
+	$file = new \SplFileObject($target_file, 'w');
63
+	if (0 === $file->fwrite($domain_list)) {
64 64
 		echo " error writing file\n";
65 65
 	} else {
66 66
 		echo " done\n";
67 67
 	}
68
-} catch ( \Exception $e ) {
68
+} catch (\Exception $e) {
69 69
 	echo " error\n";
70 70
 }
Please login to merge, or discard this patch.
src/class-dom.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -332,7 +332,6 @@
 block discarded – undo
332 332
 	 * Retrieves the tag name of the nearest block-level parent.
333 333
 	 *
334 334
 	 * @param \DOMNode $element A node.
335
-
336 335
 	 * @return string The tag name (or the empty string).
337 336
 	 */
338 337
 	public static function get_block_parent_name( \DOMNode $element ) {
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @return array
50 50
 	 */
51
-	public static function block_tags( $reset = false ) {
52
-		if ( empty( self::$block_tags ) || $reset ) {
51
+	public static function block_tags($reset = false) {
52
+		if (empty(self::$block_tags) || $reset) {
53 53
 			self::$block_tags = array_merge(
54
-				array_flip( array_filter( array_keys( \Masterminds\HTML5\Elements::$html5 ), function( $tag ) {
55
-					return \Masterminds\HTML5\Elements::isA( $tag, \Masterminds\HTML5\Elements::BLOCK_TAG );
56
-				} ) ),
57
-				array_flip( [ 'li', 'td', 'dt' ] ) // not included as "block tags" in current HTML5-PHP version.
54
+				array_flip(array_filter(array_keys(\Masterminds\HTML5\Elements::$html5), function($tag) {
55
+					return \Masterminds\HTML5\Elements::isA($tag, \Masterminds\HTML5\Elements::BLOCK_TAG);
56
+				} )),
57
+				array_flip(['li', 'td', 'dt']) // not included as "block tags" in current HTML5-PHP version.
58 58
 			);
59 59
 		}
60 60
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return array An associative array in the form ( $spl_object_hash => $node ).
71 71
 	 */
72
-	public static function nodelist_to_array( \DOMNodeList $list ) {
72
+	public static function nodelist_to_array(\DOMNodeList $list) {
73 73
 		$out = [];
74 74
 
75
-		foreach ( $list as $node ) {
76
-			$out[ spl_object_hash( $node ) ] = $node;
75
+		foreach ($list as $node) {
76
+			$out[spl_object_hash($node)] = $node;
77 77
 		}
78 78
 
79 79
 		return $out;
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return array An array of \DOMNode.
89 89
 	 */
90
-	public static function get_ancestors( \DOMNode $node ) {
90
+	public static function get_ancestors(\DOMNode $node) {
91 91
 		$result = [];
92 92
 
93
-		while ( ( $node = $node->parentNode ) && ( $node instanceof \DOMElement ) ) { // @codingStandardsIgnoreLine.
93
+		while (($node = $node->parentNode) && ($node instanceof \DOMElement)) { // @codingStandardsIgnoreLine.
94 94
 			$result[] = $node;
95 95
 		}
96 96
 
@@ -106,26 +106,26 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return boolean True if the element has any of the given class(es).
108 108
 	 */
109
-	public static function has_class( \DOMNode $tag, $classnames ) {
110
-		if ( $tag instanceof \DOMText ) {
109
+	public static function has_class(\DOMNode $tag, $classnames) {
110
+		if ($tag instanceof \DOMText) {
111 111
 			$tag = $tag->parentNode; // @codingStandardsIgnoreLine.
112 112
 		}
113 113
 
114 114
 		// Bail if we are not working with a tag or if there is no classname.
115
-		if ( ! ( $tag instanceof \DOMElement ) || empty( $classnames ) ) {
115
+		if ( ! ($tag instanceof \DOMElement) || empty($classnames)) {
116 116
 			return false;
117 117
 		}
118 118
 
119 119
 		// Ensure we always have an array of classnames.
120
-		if ( ! is_array( $classnames ) ) {
121
-			$classnames = [ $classnames ];
120
+		if ( ! is_array($classnames)) {
121
+			$classnames = [$classnames];
122 122
 		}
123 123
 
124
-		if ( $tag->hasAttribute( 'class' ) ) {
125
-			$tag_classes = array_flip( explode( ' ', $tag->getAttribute( 'class' ) ) );
124
+		if ($tag->hasAttribute('class')) {
125
+			$tag_classes = array_flip(explode(' ', $tag->getAttribute('class')));
126 126
 
127
-			foreach ( $classnames as $classname ) {
128
-				if ( isset( $tag_classes[ $classname ] ) ) {
127
+			foreach ($classnames as $classname) {
128
+				if (isset($tag_classes[$classname])) {
129 129
 					return true;
130 130
 				}
131 131
 			}
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return string A single character (or the empty string).
143 143
 	 */
144
-	public static function get_prev_chr( \DOMNode $element ) {
145
-		$previous_textnode = self::get_previous_textnode( $element );
144
+	public static function get_prev_chr(\DOMNode $element) {
145
+		$previous_textnode = self::get_previous_textnode($element);
146 146
 
147
-		if ( isset( $previous_textnode ) && isset( $previous_textnode->data ) ) {
147
+		if (isset($previous_textnode) && isset($previous_textnode->data)) {
148 148
 			// First determine encoding.
149
-			$func = Strings::functions( $previous_textnode->data );
149
+			$func = Strings::functions($previous_textnode->data);
150 150
 
151
-			if ( ! empty( $func ) ) {
152
-				return preg_replace( '/\p{C}/Su', '', $func['substr']( $previous_textnode->data, - 1 ) );
151
+			if ( ! empty($func)) {
152
+				return preg_replace('/\p{C}/Su', '', $func['substr']($previous_textnode->data, - 1));
153 153
 			}
154 154
 		} // @codeCoverageIgnore
155 155
 
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return string A single character (or the empty string).
165 165
 	 */
166
-	public static function get_next_chr( \DOMNode $element ) {
167
-		$next_textnode = self::get_next_textnode( $element );
166
+	public static function get_next_chr(\DOMNode $element) {
167
+		$next_textnode = self::get_next_textnode($element);
168 168
 
169
-		if ( isset( $next_textnode ) && isset( $next_textnode->data ) ) {
169
+		if (isset($next_textnode) && isset($next_textnode->data)) {
170 170
 			// First determine encoding.
171
-			$func = Strings::functions( $next_textnode->data );
171
+			$func = Strings::functions($next_textnode->data);
172 172
 
173
-			if ( ! empty( $func ) ) {
174
-				return preg_replace( '/\p{C}/Su', '', $func['substr']( $next_textnode->data, 0, 1 ) );
173
+			if ( ! empty($func)) {
174
+				return preg_replace('/\p{C}/Su', '', $func['substr']($next_textnode->data, 0, 1));
175 175
 			}
176 176
 		} // @codeCoverageIgnore
177 177
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return \DOMText|null Null if $element is a block-level element or no text sibling exists.
187 187
 	 */
188
-	public static function get_previous_textnode( \DOMNode $element = null ) {
189
-		return self::get_adjacent_textnode( function( &$node = null ) {
188
+	public static function get_previous_textnode(\DOMNode $element = null) {
189
+		return self::get_adjacent_textnode(function(&$node = null) {
190 190
 			$node = $node->previousSibling;
191
-			return self::get_last_textnode( $node );
192
-		}, __METHOD__, $element );
191
+			return self::get_last_textnode($node);
192
+		}, __METHOD__, $element);
193 193
 	}
194 194
 
195 195
 	/**
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return \DOMText|null Null if $element is a block-level element or no text sibling exists.
201 201
 	 */
202
-	public static function get_next_textnode( \DOMNode $element = null ) {
203
-		return self::get_adjacent_textnode( function( &$node = null ) {
202
+	public static function get_next_textnode(\DOMNode $element = null) {
203
+		return self::get_adjacent_textnode(function(&$node = null) {
204 204
 			$node = $node->nextSibling;
205
-			return self::get_first_textnode( $node );
206
-		}, __METHOD__, $element );
205
+			return self::get_first_textnode($node);
206
+		}, __METHOD__, $element);
207 207
 	}
208 208
 
209 209
 	/**
@@ -215,22 +215,22 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return \DOMText|null Null if $element is a block-level element or no text sibling exists.
217 217
 	 */
218
-	private static function get_adjacent_textnode( callable $iterate, callable $get_adjacent_parent, \DOMNode $element = null ) {
219
-		if ( ! isset( $element ) ) {
218
+	private static function get_adjacent_textnode(callable $iterate, callable $get_adjacent_parent, \DOMNode $element = null) {
219
+		if ( ! isset($element)) {
220 220
 			return null;
221
-		} elseif ( $element instanceof \DOMElement && isset( self::$block_tags[ $element->tagName ] ) ) {
221
+		} elseif ($element instanceof \DOMElement && isset(self::$block_tags[$element->tagName])) {
222 222
 			return null;
223 223
 		}
224 224
 
225 225
 		$adjacent = null;
226 226
 		$node     = $element;
227 227
 
228
-		while ( ! empty( $node ) && empty( $adjacent ) ) {
229
-			$adjacent = $iterate( $node );
228
+		while ( ! empty($node) && empty($adjacent)) {
229
+			$adjacent = $iterate($node);
230 230
 		}
231 231
 
232
-		if ( empty( $adjacent ) ) {
233
-			$adjacent = $get_adjacent_parent( $element->parentNode );
232
+		if (empty($adjacent)) {
233
+			$adjacent = $get_adjacent_parent($element->parentNode);
234 234
 		}
235 235
 
236 236
 		return $adjacent;
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return \DOMText|null The first child of type \DOMText, the element itself if it is of type \DOMText or null.
246 246
 	 */
247
-	public static function get_first_textnode( \DOMNode $element = null, $recursive = false ) {
248
-		return self::get_edge_textnode( function( \DOMNodeList $children, \DOMText &$first_textnode = null ) {
247
+	public static function get_first_textnode(\DOMNode $element = null, $recursive = false) {
248
+		return self::get_edge_textnode(function(\DOMNodeList $children, \DOMText & $first_textnode = null) {
249 249
 			$i = 0;
250 250
 
251
-			while ( $i < $children->length && empty( $first_textnode ) ) {
252
-				$first_textnode = self::get_first_textnode( $children->item( $i ), true );
251
+			while ($i < $children->length && empty($first_textnode)) {
252
+				$first_textnode = self::get_first_textnode($children->item($i), true);
253 253
 				$i++;
254 254
 			}
255
-		}, $element, $recursive );
255
+		}, $element, $recursive);
256 256
 	}
257 257
 
258 258
 	/**
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return \DOMText|null The last child of type \DOMText, the element itself if it is of type \DOMText or null.
265 265
 	 */
266
-	public static function get_last_textnode( \DOMNode $element = null, $recursive = false ) {
267
-		return self::get_edge_textnode( function( \DOMNodeList $children, \DOMText &$last_textnode = null ) {
266
+	public static function get_last_textnode(\DOMNode $element = null, $recursive = false) {
267
+		return self::get_edge_textnode(function(\DOMNodeList $children, \DOMText & $last_textnode = null) {
268 268
 			$i = $children->length - 1;
269 269
 
270
-			while ( $i >= 0 && empty( $last_textnode ) ) {
271
-				$last_textnode = self::get_last_textnode( $children->item( $i ), true );
270
+			while ($i >= 0 && empty($last_textnode)) {
271
+				$last_textnode = self::get_last_textnode($children->item($i), true);
272 272
 				$i--;
273 273
 			}
274
-		}, $element, $recursive );
274
+		}, $element, $recursive);
275 275
 	}
276 276
 
277 277
 	/**
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return \DOMText|null The last child of type \DOMText, the element itself if it is of type \DOMText or null.
287 287
 	 */
288
-	private static function get_edge_textnode( callable $iteration, \DOMNode $element = null, $recursive = false ) {
289
-		if ( ! isset( $element ) ) {
288
+	private static function get_edge_textnode(callable $iteration, \DOMNode $element = null, $recursive = false) {
289
+		if ( ! isset($element)) {
290 290
 			return null;
291 291
 		}
292 292
 
293
-		if ( $element instanceof \DOMText ) {
293
+		if ($element instanceof \DOMText) {
294 294
 			return $element;
295
-		} elseif ( ! $element instanceof \DOMElement ) {
295
+		} elseif ( ! $element instanceof \DOMElement) {
296 296
 			// Return null if $element is neither \DOMText nor \DOMElement.
297 297
 			return null;
298
-		} elseif ( $recursive && isset( self::$block_tags[ $element->tagName ] ) ) {
298
+		} elseif ($recursive && isset(self::$block_tags[$element->tagName])) {
299 299
 			return null;
300 300
 		}
301 301
 
302 302
 		$edge_textnode = null;
303 303
 
304
-		if ( $element->hasChildNodes() ) {
305
-			$iteration( $element->childNodes, $edge_textnode );
304
+		if ($element->hasChildNodes()) {
305
+			$iteration($element->childNodes, $edge_textnode);
306 306
 		}
307 307
 
308 308
 		return $edge_textnode;
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return \DOMElement|null
317 317
 	 */
318
-	public static function get_block_parent( \DOMNode $element ) {
318
+	public static function get_block_parent(\DOMNode $element) {
319 319
 		$parent = $element->parentNode;
320
-		if ( ! $parent instanceof \DOMElement ) {
320
+		if ( ! $parent instanceof \DOMElement) {
321 321
 			return null;
322 322
 		}
323 323
 
324
-		while ( ! isset( self::$block_tags[ $parent->tagName ] ) && ! empty( $parent->parentNode ) && $parent->parentNode instanceof \DOMElement ) {
324
+		while ( ! isset(self::$block_tags[$parent->tagName]) && ! empty($parent->parentNode) && $parent->parentNode instanceof \DOMElement) {
325 325
 			$parent = $parent->parentNode;
326 326
 		}
327 327
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
 	 * @return string The tag name (or the empty string).
337 337
 	 */
338
-	public static function get_block_parent_name( \DOMNode $element ) {
339
-		$parent = self::get_block_parent( $element );
338
+	public static function get_block_parent_name(\DOMNode $element) {
339
+		$parent = self::get_block_parent($element);
340 340
 
341
-		if ( ! empty( $parent ) ) {
341
+		if ( ! empty($parent)) {
342 342
 			return $parent->tagName;
343 343
 		} else {
344 344
 			return '';
Please login to merge, or discard this patch.