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.
Test Setup Failed
Branch master (2d2662)
by Der Mundschenk
01:59
created
src/bin/class-pattern-converter.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
 	 * @param string $line     A line from the TeX pattern file.
220 220
 	 * @param array  $patterns An array of patterns.
221 221
 	 *
222
-	 * @return boolean
222
+	 * @return boolean|null
223 223
 	 */
224 224
 	function match_patterns( $line, array &$patterns ) {
225 225
 		if ( preg_match( '/^\s*([' . $this->word_characters . ']+)\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * @param string $pattern TeX hyphenation pattern.
64 64
 	 * @return string
65 65
 	 */
66
-	function get_segment( $pattern ) {
67
-		return preg_replace( '/[0-9]/', '', str_replace( '.', '_', $pattern ) );
66
+	function get_segment($pattern) {
67
+		return preg_replace('/[0-9]/', '', str_replace('.', '_', $pattern));
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,31 +74,31 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string|null Script exits on error.
76 76
 	 */
77
-	function get_sequence( $pattern ) {
78
-		$characters = Strings::mb_str_split( str_replace( '.', '_', $pattern ) );
77
+	function get_sequence($pattern) {
78
+		$characters = Strings::mb_str_split(str_replace('.', '_', $pattern));
79 79
 		$result = [];
80 80
 
81
-		foreach ( $characters as $index => $chr ) {
82
-			if ( ctype_digit( $chr ) ) {
81
+		foreach ($characters as $index => $chr) {
82
+			if (ctype_digit($chr)) {
83 83
 				$result[] = $chr;
84 84
 			} else {
85
-				if ( ! isset( $characters[ $index - 1 ] ) || ! ctype_digit( $characters[ $index - 1 ] ) ) {
85
+				if ( ! isset($characters[$index - 1]) || ! ctype_digit($characters[$index - 1])) {
86 86
 					$result[] = '0';
87 87
 				}
88 88
 
89
-				if ( ! isset( $characters[ $index + 1 ] ) && ! ctype_digit( $characters[ $index ] ) ) {
89
+				if ( ! isset($characters[$index + 1]) && ! ctype_digit($characters[$index])) {
90 90
 					$result[] = '0';
91 91
 				}
92 92
 			}
93 93
 		}
94 94
 
95 95
 		// Do some error checking.
96
-		$count = count( $result );
97
-		$count_seg = mb_strlen( $this->get_segment( $pattern ) );
98
-		$sequence = implode( $result );
96
+		$count = count($result);
97
+		$count_seg = mb_strlen($this->get_segment($pattern));
98
+		$sequence = implode($result);
99 99
 
100
-		if ( $count !== $count_seg + 1 ) {
101
-			trigger_error( "Invalid segment length $count for pattern $pattern (result sequence $sequence)", E_USER_ERROR ); // @codingStandardsIgnoreLine
100
+		if ($count !== $count_seg + 1) {
101
+			trigger_error("Invalid segment length $count for pattern $pattern (result sequence $sequence)", E_USER_ERROR); // @codingStandardsIgnoreLine
102 102
 
103 103
 			die( -3000 );
104 104
 		}
@@ -119,32 +119,32 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return string
121 121
 	 */
122
-	function format_results( array $patterns, array $exceptions, array $comments ) {
122
+	function format_results(array $patterns, array $exceptions, array $comments) {
123 123
 		$pattern_mapping = [];
124 124
 
125
-		foreach ( $patterns as $pattern ) {
126
-			$segment = $this->get_segment( $pattern );
125
+		foreach ($patterns as $pattern) {
126
+			$segment = $this->get_segment($pattern);
127 127
 
128
-			if ( ! isset( $pattern_mapping[ $segment ] ) ) {
129
-				$pattern_mapping[ $segment ] = $this->get_sequence( $pattern );
128
+			if ( ! isset($pattern_mapping[$segment])) {
129
+				$pattern_mapping[$segment] = $this->get_sequence($pattern);
130 130
 			}
131 131
 		}
132 132
 
133 133
 		// Produce a nice exceptions mapping.
134 134
 		$json_exceptions = [];
135
-		foreach ( $exceptions as $exception ) {
136
-			$json_exceptions[ mb_strtolower( str_replace( '-', '', $exception ) ) ] = mb_strtolower( $exception );
135
+		foreach ($exceptions as $exception) {
136
+			$json_exceptions[mb_strtolower(str_replace('-', '', $exception))] = mb_strtolower($exception);
137 137
 		}
138 138
 
139 139
 		$json_results = [
140 140
 			'language'         => $this->language,
141 141
 			'source_url'       => $this->url,
142
-			'copyright'        => array_map( 'rtrim', $comments ),
142
+			'copyright'        => array_map('rtrim', $comments),
143 143
 			'exceptions'       => $json_exceptions,
144 144
 			'patterns'         => $pattern_mapping,
145 145
 		];
146 146
 
147
-		return json_encode( $json_results, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
147
+		return json_encode($json_results, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 	 * @param string $url      The TeX pattern file URL.
154 154
 	 * @param string $language A human-readable language name.
155 155
 	 */
156
-	function __construct( $url, $language ) {
156
+	function __construct($url, $language) {
157 157
 		$this->url      = $url;
158 158
 		$this->language = $language;
159 159
 
160
-		$this->word_characters = join( [
160
+		$this->word_characters = join([
161 161
 			"\w.'ʼ᾽ʼ᾿’",
162
-			Strings::uchr( 8205, 8204, 768, 769, 771, 772, 775, 776, 784, 803, 805, 814, 817 ),
163
-			'\p{Devanagari}' . Strings::uchr( 2385, 2386 ),
162
+			Strings::uchr(8205, 8204, 768, 769, 771, 772, 775, 776, 784, 803, 805, 814, 817),
163
+			'\p{Devanagari}' . Strings::uchr(2385, 2386),
164 164
 			'\p{Bengali}',
165 165
 			'\p{Gujarati}',
166 166
 			'\p{Gurmukhi}',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 			'\p{Malayalam}',
172 172
 			'\p{Thai}',
173 173
 			'-',
174
-		] );
174
+		]);
175 175
 	}
176 176
 
177 177
 	/**
@@ -186,23 +186,23 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return boolean|null Script exits on error.
188 188
 	 */
189
-	function match_exceptions( $line, array &$exceptions ) {
190
-		if ( preg_match( '/^\s*([\w-]+)\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
189
+	function match_exceptions($line, array &$exceptions) {
190
+		if (preg_match('/^\s*([\w-]+)\s*}\s*(?:%.*)?$/u', $line, $matches)) {
191 191
 			$exceptions[] = $matches[1];
192 192
 			return false;
193
-		} if ( preg_match( '/^\s*((?:[\w-]+\s*)+)\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
194
-			$this->match_exceptions( $matches[1], $exceptions );
193
+		} if (preg_match('/^\s*((?:[\w-]+\s*)+)\s*}\s*(?:%.*)?$/u', $line, $matches)) {
194
+			$this->match_exceptions($matches[1], $exceptions);
195 195
 			return false;
196
-		} elseif ( preg_match( '/^\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
196
+		} elseif (preg_match('/^\s*}\s*(?:%.*)?$/u', $line, $matches)) {
197 197
 			return false;
198
-		} elseif ( preg_match( '/^\s*([\w-]+)\s*(?:%.*)?$/u',  $line, $matches ) ) {
198
+		} elseif (preg_match('/^\s*([\w-]+)\s*(?:%.*)?$/u', $line, $matches)) {
199 199
 			$exceptions[] = $matches[1];
200
-		} elseif ( preg_match( '/^\s*((?:[\w-]+\s*)+)(?:%.*)?$/u',  $line, $matches ) ) {
200
+		} elseif (preg_match('/^\s*((?:[\w-]+\s*)+)(?:%.*)?$/u', $line, $matches)) {
201 201
 			// Sometimes there are multiple exceptions on a single line.
202
-			foreach ( self::split_at_whitespace( $matches[1] ) as $match ) {
202
+			foreach (self::split_at_whitespace($matches[1]) as $match) {
203 203
 				$exceptions[] = $match;
204 204
 			}
205
-		} elseif ( preg_match( '/^\s*(?:%.*)?$/u', $line, $matches ) ) {
205
+		} elseif (preg_match('/^\s*(?:%.*)?$/u', $line, $matches)) {
206 206
 			// Ignore comments and whitespace in exceptions.
207 207
 			return true;
208 208
 		} else {
@@ -221,24 +221,24 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return boolean
223 223
 	 */
224
-	function match_patterns( $line, array &$patterns ) {
225
-		if ( preg_match( '/^\s*([' . $this->word_characters . ']+)\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
224
+	function match_patterns($line, array &$patterns) {
225
+		if (preg_match('/^\s*([' . $this->word_characters . ']+)\s*}\s*(?:%.*)?$/u', $line, $matches)) {
226 226
 			$patterns[] = $matches[1];
227 227
 			return false;
228
-		} elseif ( preg_match( '/^\s*}\s*(?:%.*)?$/u', $line, $matches ) ) {
228
+		} elseif (preg_match('/^\s*}\s*(?:%.*)?$/u', $line, $matches)) {
229 229
 			return false;
230
-		} elseif ( preg_match( '/^\s*([' . $this->word_characters . ']+)\s*(?:%.*)?$/u',  $line, $matches ) ) {
230
+		} elseif (preg_match('/^\s*([' . $this->word_characters . ']+)\s*(?:%.*)?$/u', $line, $matches)) {
231 231
 			$patterns[] = $matches[1];
232
-		} elseif ( preg_match( '/^\s*((?:[' . $this->word_characters . ']+\s*)+)(?:%.*)?$/u',  $line, $matches ) ) {
232
+		} elseif (preg_match('/^\s*((?:[' . $this->word_characters . ']+\s*)+)(?:%.*)?$/u', $line, $matches)) {
233 233
 			// Sometimes there are multiple patterns on a single line.
234
-			foreach ( self::split_at_whitespace( $matches[1] ) as $match ) {
234
+			foreach (self::split_at_whitespace($matches[1]) as $match) {
235 235
 				$patterns[] = $match;
236 236
 			}
237
-		} elseif ( preg_match( '/^\s*(?:%.*)?$/u', $line, $matches ) ) {
237
+		} elseif (preg_match('/^\s*(?:%.*)?$/u', $line, $matches)) {
238 238
 			// Ignore comments and whitespace in patterns.
239 239
 			return true;
240 240
 		} else {
241
-			echo 'Error: unknown pattern line ' . htmlentities( $line, ENT_NOQUOTES | ENT_HTML5 ) . "\n"; // xss ok.
241
+			echo 'Error: unknown pattern line ' . htmlentities($line, ENT_NOQUOTES | ENT_HTML5) . "\n"; // xss ok.
242 242
 			die( -1000 );
243 243
 		}
244 244
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return array
254 254
 	 */
255
-	private static function split_at_whitespace( $line ) {
256
-		return preg_split( '/\s+/Su', $line, -1, PREG_SPLIT_NO_EMPTY );
255
+	private static function split_at_whitespace($line) {
256
+		return preg_split('/\s+/Su', $line, -1, PREG_SPLIT_NO_EMPTY);
257 257
 	}
258 258
 
259 259
 	/**
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @return string
263 263
 	 */
264 264
 	function convert() {
265
-		if ( ! file_exists( $this->url ) ) {
266
-			$file_headers = @get_headers( $this->url );
267
-			if ( 'HTTP/1.0 404 Not Found' === $file_headers[0] ) {
265
+		if ( ! file_exists($this->url)) {
266
+			$file_headers = @get_headers($this->url);
267
+			if ('HTTP/1.0 404 Not Found' === $file_headers[0]) {
268 268
 				echo "Error: unknown pattern file '{$this->url}'\n"; // xss ok.
269 269
 				die( -3 );
270 270
 			}
@@ -279,29 +279,29 @@  discard block
 block discarded – undo
279 279
 		$reading_patterns   = false;
280 280
 		$reading_exceptions = false;
281 281
 
282
-		$file = new \SplFileObject( $this->url );
283
-		while ( ! $file->eof() ) {
282
+		$file = new \SplFileObject($this->url);
283
+		while ( ! $file->eof()) {
284 284
 			$line = $file->fgets();
285 285
 
286
-			if ( $reading_patterns ) {
287
-				$reading_patterns = $this->match_patterns( $line, $patterns );
288
-			} elseif ( $reading_exceptions ) {
289
-				$reading_exceptions = $this->match_exceptions( $line, $exceptions );
286
+			if ($reading_patterns) {
287
+				$reading_patterns = $this->match_patterns($line, $patterns);
288
+			} elseif ($reading_exceptions) {
289
+				$reading_exceptions = $this->match_exceptions($line, $exceptions);
290 290
 			} else {
291 291
 				// Not a pattern & not an exception.
292
-				if ( preg_match( '/^\s*%.*$/u', $line, $matches ) ) {
292
+				if (preg_match('/^\s*%.*$/u', $line, $matches)) {
293 293
 					$comments[] = $line;
294
-				} elseif ( preg_match( '/^\s*\\\patterns\s*\{\s*(.*)$/u', $line, $matches ) ) {
295
-					$reading_patterns = $this->match_patterns( $matches[1], $patterns );
296
-				} elseif ( preg_match( '/^\s*\\\hyphenation\s*{\s*(.*)$/u', $line, $matches ) ) {
297
-					$reading_exceptions = $this->match_exceptions( $matches[1], $exceptions );
298
-				} elseif ( preg_match( '/^\s*\\\endinput.*$/u', $line, $matches ) ) {
294
+				} elseif (preg_match('/^\s*\\\patterns\s*\{\s*(.*)$/u', $line, $matches)) {
295
+					$reading_patterns = $this->match_patterns($matches[1], $patterns);
296
+				} elseif (preg_match('/^\s*\\\hyphenation\s*{\s*(.*)$/u', $line, $matches)) {
297
+					$reading_exceptions = $this->match_exceptions($matches[1], $exceptions);
298
+				} elseif (preg_match('/^\s*\\\endinput.*$/u', $line, $matches)) {
299 299
 					// Ignore this line completely.
300 300
 					continue;
301
-				} elseif ( preg_match( '/^\s*\\\[\w]+.*$/u', $line, $matches ) ) {
301
+				} elseif (preg_match('/^\s*\\\[\w]+.*$/u', $line, $matches)) {
302 302
 					// Treat other commands as comments unless we are matching exceptions or patterns.
303 303
 					$comments[] = $line;
304
-				} elseif ( preg_match( '/^\s*$/u', $line, $matches ) ) {
304
+				} elseif (preg_match('/^\s*$/u', $line, $matches)) {
305 305
 					continue; // Do nothing.
306 306
 				} else {
307 307
 					echo "Error: unknown line $line\n"; // xss ok.
@@ -310,6 +310,6 @@  discard block
 block discarded – undo
310 310
 			}
311 311
 		}
312 312
 
313
-		return $this->format_results( $patterns, $exceptions, $comments );
313
+		return $this->format_results($patterns, $exceptions, $comments);
314 314
 	}
315 315
 }
Please login to merge, or discard this patch.
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/class-settings.php 1 patch
Spacing   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @param bool $set_defaults If true, set default values for various properties. Defaults to true.
100 100
 	 */
101
-	public function __construct( $set_defaults = true ) {
102
-		$this->init( $set_defaults );
101
+	public function __construct($set_defaults = true) {
102
+		$this->init($set_defaults);
103 103
 	}
104 104
 
105 105
 	/**
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return mixed
111 111
 	 */
112
-	public function &__get( $key ) {
113
-		return $this->data[ $key ];
112
+	public function &__get($key) {
113
+		return $this->data[$key];
114 114
 	}
115 115
 
116 116
 	/**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @param string $key   The settings key.
120 120
 	 * @param mixed  $value The settings value.
121 121
 	 */
122
-	public function __set( $key, $value ) {
123
-		$this->data[ $key ] = $value;
122
+	public function __set($key, $value) {
123
+		$this->data[$key] = $value;
124 124
 	}
125 125
 
126 126
 	/**
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @param string $key The settings key.
130 130
 	 */
131
-	public function __isset( $key ) {
132
-		return isset( $this->data[ $key ] );
131
+	public function __isset($key) {
132
+		return isset($this->data[$key]);
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @param string $key The settings key.
139 139
 	 */
140
-	public function __unset( $key ) {
141
-		unset( $this->data[ $key ] );
140
+	public function __unset($key) {
141
+		unset($this->data[$key]);
142 142
 	}
143 143
 
144 144
 	/**
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @param string $offset The settings key.
148 148
 	 * @param mixed  $value  The settings value.
149 149
 	 */
150
-	public function offsetSet( $offset, $value ) {
151
-		if ( is_null( $offset ) ) {
150
+	public function offsetSet($offset, $value) {
151
+		if (is_null($offset)) {
152 152
 			$this->data[] = $value;
153 153
 		} else {
154
-			$this->data[ $offset ] = $value;
154
+			$this->data[$offset] = $value;
155 155
 		}
156 156
 	}
157 157
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @param string $offset The settings key.
162 162
 	 */
163
-	public function offsetExists( $offset ) {
164
-		return isset( $this->data[ $offset ] );
163
+	public function offsetExists($offset) {
164
+		return isset($this->data[$offset]);
165 165
 	}
166 166
 
167 167
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @param string $offset The settings key.
171 171
 	 */
172
-	public function offsetUnset( $offset ) {
173
-		unset( $this->data[ $offset ] );
172
+	public function offsetUnset($offset) {
173
+		unset($this->data[$offset]);
174 174
 	}
175 175
 
176 176
 	/**
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return mixed
182 182
 	 */
183
-	public function offsetGet( $offset ) {
184
-		return isset( $this->data[ $offset ] ) ? $this->data[ $offset ] : null;
183
+	public function offsetGet($offset) {
184
+		return isset($this->data[$offset]) ? $this->data[$offset] : null;
185 185
 	}
186 186
 
187 187
 	/**
@@ -235,21 +235,21 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param bool $set_defaults If true, set default values for various properties. Defaults to true.
237 237
 	 */
238
-	private function init( $set_defaults = true ) {
239
-		$this->no_break_narrow_space = U::NO_BREAK_SPACE;  // used in unit spacing - can be changed to 8239 via set_true_no_break_narrow_space.
238
+	private function init($set_defaults = true) {
239
+		$this->no_break_narrow_space = U::NO_BREAK_SPACE; // used in unit spacing - can be changed to 8239 via set_true_no_break_narrow_space.
240 240
 
241
-		$this->dash_style = new Settings\Simple_Dashes( U::EM_DASH, U::THIN_SPACE, U::EN_DASH, U::THIN_SPACE );
241
+		$this->dash_style = new Settings\Simple_Dashes(U::EM_DASH, U::THIN_SPACE, U::EN_DASH, U::THIN_SPACE);
242 242
 
243
-		$this->primary_quote_style   = new Settings\Simple_Quotes( U::DOUBLE_QUOTE_OPEN, U::DOUBLE_QUOTE_CLOSE );
244
-		$this->secondary_quote_style = new Settings\Simple_Quotes( U::SINGLE_QUOTE_OPEN, U::SINGLE_QUOTE_CLOSE );
243
+		$this->primary_quote_style   = new Settings\Simple_Quotes(U::DOUBLE_QUOTE_OPEN, U::DOUBLE_QUOTE_CLOSE);
244
+		$this->secondary_quote_style = new Settings\Simple_Quotes(U::SINGLE_QUOTE_OPEN, U::SINGLE_QUOTE_CLOSE);
245 245
 
246 246
 		// Set up some arrays for quick HTML5 introspection.
247
-		$this->self_closing_tags = array_filter( array_keys( \Masterminds\HTML5\Elements::$html5 ), function( $tag ) {
248
-			return \Masterminds\HTML5\Elements::isA( $tag, \Masterminds\HTML5\Elements::VOID_TAG );
247
+		$this->self_closing_tags = array_filter(array_keys(\Masterminds\HTML5\Elements::$html5), function($tag) {
248
+			return \Masterminds\HTML5\Elements::isA($tag, \Masterminds\HTML5\Elements::VOID_TAG);
249 249
 		} );
250
-		$this->inappropriate_tags = [ 'iframe', 'textarea', 'button', 'select', 'optgroup', 'option', 'map', 'style', 'head', 'title', 'script', 'applet', 'object', 'param' ];
250
+		$this->inappropriate_tags = ['iframe', 'textarea', 'button', 'select', 'optgroup', 'option', 'map', 'style', 'head', 'title', 'script', 'applet', 'object', 'param'];
251 251
 
252
-		if ( $set_defaults ) {
252
+		if ($set_defaults) {
253 253
 			$this->set_defaults();
254 254
 		}
255 255
 	}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param bool $on Optional. Default false.
327 327
 	 */
328
-	public function set_ignore_parser_errors( $on = false ) {
328
+	public function set_ignore_parser_errors($on = false) {
329 329
 		$this->data['parserErrorsIgnore'] = $on;
330 330
 	}
331 331
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 *
335 335
 	 * @param callable|null $handler Optional. A callable that takes an array of error strings as its parameter. Default null.
336 336
 	 */
337
-	public function set_parser_errors_handler( $handler = null ) {
338
-		if ( ! empty( $handler ) && ! is_callable( $handler ) ) {
337
+	public function set_parser_errors_handler($handler = null) {
338
+		if ( ! empty($handler) && ! is_callable($handler)) {
339 339
 			return; // Invalid handler, abort.
340 340
 		}
341 341
 
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @param bool $on Optional. Default false.
349 349
 	 */
350
-	public function set_true_no_break_narrow_space( $on = false ) {
350
+	public function set_true_no_break_narrow_space($on = false) {
351 351
 
352
-		if ( $on ) {
352
+		if ($on) {
353 353
 			$this->no_break_narrow_space = U::NO_BREAK_NARROW_SPACE;
354 354
 		} else {
355 355
 			$this->no_break_narrow_space = U::NO_BREAK_SPACE;
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
 	 *
362 362
 	 * @param string|array $tags A comma separated list or an array of tag names.
363 363
 	 */
364
-	public function set_tags_to_ignore( $tags = [ 'code', 'head', 'kbd', 'object', 'option', 'pre', 'samp', 'script', 'noscript', 'noembed', 'select', 'style', 'textarea', 'title', 'var', 'math' ] ) {
364
+	public function set_tags_to_ignore($tags = ['code', 'head', 'kbd', 'object', 'option', 'pre', 'samp', 'script', 'noscript', 'noembed', 'select', 'style', 'textarea', 'title', 'var', 'math']) {
365 365
 		// Ensure that we pass only lower-case tag names to XPath.
366
-		$tags = array_filter( array_map( 'strtolower', Strings::maybe_split_parameters( $tags ) ), 'ctype_alnum' );
366
+		$tags = array_filter(array_map('strtolower', Strings::maybe_split_parameters($tags)), 'ctype_alnum');
367 367
 
368 368
 		// Self closing tags shouldn't be in $tags.
369
-		$this->data['ignoreTags'] = array_unique( array_merge( array_diff( $tags, $this->self_closing_tags ), $this->inappropriate_tags ) );
369
+		$this->data['ignoreTags'] = array_unique(array_merge(array_diff($tags, $this->self_closing_tags), $this->inappropriate_tags));
370 370
 	}
371 371
 
372 372
 	/**
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @param string|array $classes A comma separated list or an array of class names.
376 376
 	 */
377
-	 function set_classes_to_ignore( $classes = [ 'vcard', 'noTypo' ] ) {
378
-		$this->data['ignoreClasses'] = Strings::maybe_split_parameters( $classes );
377
+	 function set_classes_to_ignore($classes = ['vcard', 'noTypo']) {
378
+		$this->data['ignoreClasses'] = Strings::maybe_split_parameters($classes);
379 379
 	}
380 380
 
381 381
 	/**
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 *
384 384
 	 * @param string|array $ids A comma separated list or an array of tag names.
385 385
 	 */
386
-	public function set_ids_to_ignore( $ids = [] ) {
387
-		$this->data['ignoreIDs'] = Strings::maybe_split_parameters( $ids );
386
+	public function set_ids_to_ignore($ids = []) {
387
+		$this->data['ignoreIDs'] = Strings::maybe_split_parameters($ids);
388 388
 	}
389 389
 
390 390
 	/**
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @param bool $on Optional. Default true.
394 394
 	 */
395
-	public function set_smart_quotes( $on = true ) {
395
+	public function set_smart_quotes($on = true) {
396 396
 		$this->data['smartQuotes'] = $on;
397 397
 	}
398 398
 
@@ -418,17 +418,17 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param string $style Defaults to 'doubleCurled.
420 420
 	 */
421
-	public function set_smart_quotes_primary( $style = Quote_Style::DOUBLE_CURLED ) {
422
-		if ( $style instanceof Settings\Quotes ) {
421
+	public function set_smart_quotes_primary($style = Quote_Style::DOUBLE_CURLED) {
422
+		if ($style instanceof Settings\Quotes) {
423 423
 			$quotes = $style;
424 424
 		} else {
425
-			$quotes = Quote_Style::get_styled_quotes( $style, $this );
425
+			$quotes = Quote_Style::get_styled_quotes($style, $this);
426 426
 		}
427 427
 
428
-		if ( ! empty( $quotes ) ) {
428
+		if ( ! empty($quotes)) {
429 429
 			$this->primary_quote_style = $quotes;
430 430
 		} else {
431
-			trigger_error( "Invalid quote style $style.", E_USER_WARNING ); // @codingStandardsIgnoreLine.
431
+			trigger_error("Invalid quote style $style.", E_USER_WARNING); // @codingStandardsIgnoreLine.
432 432
 		}
433 433
 	}
434 434
 
@@ -454,17 +454,17 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $style Defaults to 'singleCurled'.
456 456
 	 */
457
-	public function set_smart_quotes_secondary( $style = Quote_Style::SINGLE_CURLED ) {
458
-		if ( $style instanceof Settings\Quotes ) {
457
+	public function set_smart_quotes_secondary($style = Quote_Style::SINGLE_CURLED) {
458
+		if ($style instanceof Settings\Quotes) {
459 459
 			$quotes = $style;
460 460
 		} else {
461
-			$quotes = Quote_Style::get_styled_quotes( $style, $this );
461
+			$quotes = Quote_Style::get_styled_quotes($style, $this);
462 462
 		}
463 463
 
464
-		if ( ! empty( $quotes ) ) {
464
+		if ( ! empty($quotes)) {
465 465
 			$this->secondary_quote_style = $quotes;
466 466
 		} else {
467
-			trigger_error( "Invalid quote style $style.", E_USER_WARNING ); // @codingStandardsIgnoreLine.
467
+			trigger_error("Invalid quote style $style.", E_USER_WARNING); // @codingStandardsIgnoreLine.
468 468
 		}
469 469
 	}
470 470
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @param bool $on Optional. Default true.
475 475
 	 */
476
-	public function set_smart_dashes( $on = true ) {
476
+	public function set_smart_dashes($on = true) {
477 477
 		$this->data['smartDashes'] = $on;
478 478
 	}
479 479
 
@@ -486,17 +486,17 @@  discard block
 block discarded – undo
486 486
 	 *
487 487
 	 * @param string|Settings\Dashes $style Optional. Default Dash_Style::TRADITIONAL_US.
488 488
 	 */
489
-	public function set_smart_dashes_style( $style = Dash_Style::TRADITIONAL_US ) {
490
-		if ( $style instanceof Settings\Dashes ) {
489
+	public function set_smart_dashes_style($style = Dash_Style::TRADITIONAL_US) {
490
+		if ($style instanceof Settings\Dashes) {
491 491
 			$dashes = $style;
492 492
 		} else {
493
-			$dashes = Dash_Style::get_styled_dashes( $style, $this );
493
+			$dashes = Dash_Style::get_styled_dashes($style, $this);
494 494
 		}
495 495
 
496
-		if ( ! empty( $dashes ) ) {
496
+		if ( ! empty($dashes)) {
497 497
 			$this->dash_style = $dashes;
498 498
 		} else {
499
-			trigger_error( "Invalid dash style $style.", E_USER_WARNING ); // @codingStandardsIgnoreLine.
499
+			trigger_error("Invalid dash style $style.", E_USER_WARNING); // @codingStandardsIgnoreLine.
500 500
 		}
501 501
 	}
502 502
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @param bool $on Optional. Default true.
507 507
 	 */
508
-	public function set_smart_ellipses( $on = true ) {
508
+	public function set_smart_ellipses($on = true) {
509 509
 		$this->data['smartEllipses'] = $on;
510 510
 	}
511 511
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param bool $on Optional. Default true.
516 516
 	 */
517
-	public function set_smart_diacritics( $on = true ) {
517
+	public function set_smart_diacritics($on = true) {
518 518
 		$this->data['smartDiacritics'] = $on;
519 519
 	}
520 520
 
@@ -523,19 +523,19 @@  discard block
 block discarded – undo
523 523
 	 *
524 524
 	 * @param string $lang Has to correspond to a filename in 'diacritics'. Optional. Default 'en-US'.
525 525
 	 */
526
-	public function set_diacritic_language( $lang = 'en-US' ) {
527
-		if ( isset( $this->data['diacriticLanguage'] ) && $this->data['diacriticLanguage'] === $lang ) {
526
+	public function set_diacritic_language($lang = 'en-US') {
527
+		if (isset($this->data['diacriticLanguage']) && $this->data['diacriticLanguage'] === $lang) {
528 528
 			return;
529 529
 		}
530 530
 
531 531
 		$this->data['diacriticLanguage'] = $lang;
532
-		$language_file_name = dirname( __FILE__ ) . '/diacritics/' . $lang . '.json';
532
+		$language_file_name = dirname(__FILE__) . '/diacritics/' . $lang . '.json';
533 533
 
534
-		if ( file_exists( $language_file_name ) ) {
535
-			$diacritics_file = json_decode( file_get_contents( $language_file_name ), true );
534
+		if (file_exists($language_file_name)) {
535
+			$diacritics_file = json_decode(file_get_contents($language_file_name), true);
536 536
 			$this->data['diacriticWords'] = $diacritics_file['diacritic_words'];
537 537
 		} else {
538
-			unset( $this->data['diacriticWords'] );
538
+			unset($this->data['diacriticWords']);
539 539
 		}
540 540
 
541 541
 		$this->update_diacritics_replacement_arrays();
@@ -547,21 +547,21 @@  discard block
 block discarded – undo
547 547
 	 * @param string|array $custom_replacements An array formatted [needle=>replacement, needle=>replacement...],
548 548
 	 *                                          or a string formatted `"needle"=>"replacement","needle"=>"replacement",...
549 549
 	 */
550
-	public function set_diacritic_custom_replacements( $custom_replacements = [] ) {
551
-		if ( ! is_array( $custom_replacements ) ) {
552
-			$custom_replacements = $this->parse_diacritics_replacement_string( $custom_replacements );
550
+	public function set_diacritic_custom_replacements($custom_replacements = []) {
551
+		if ( ! is_array($custom_replacements)) {
552
+			$custom_replacements = $this->parse_diacritics_replacement_string($custom_replacements);
553 553
 		}
554 554
 
555
-		$this->data['diacriticCustomReplacements'] = Arrays::array_map_assoc( function( $key, $replacement ) {
556
-			$key         = strip_tags( trim( $key ) );
557
-			$replacement = strip_tags( trim( $replacement ) );
555
+		$this->data['diacriticCustomReplacements'] = Arrays::array_map_assoc(function($key, $replacement) {
556
+			$key         = strip_tags(trim($key));
557
+			$replacement = strip_tags(trim($replacement));
558 558
 
559
-			if ( ! empty( $key ) && ! empty( $replacement ) ) {
560
-				return [ $key, $replacement ];
559
+			if ( ! empty($key) && ! empty($replacement)) {
560
+				return [$key, $replacement];
561 561
 			} else {
562 562
 				return [];
563 563
 			}
564
-		}, $custom_replacements );
564
+		}, $custom_replacements);
565 565
 
566 566
 		$this->update_diacritics_replacement_arrays();
567 567
 	}
@@ -573,25 +573,25 @@  discard block
 block discarded – undo
573 573
 	 *
574 574
 	 * @return array
575 575
 	 */
576
-	private function parse_diacritics_replacement_string( $custom_replacements ) {
577
-		return Arrays::array_map_assoc( function( $key, $replacement ) {
576
+	private function parse_diacritics_replacement_string($custom_replacements) {
577
+		return Arrays::array_map_assoc(function($key, $replacement) {
578 578
 
579 579
 			// Account for single and double quotes in keys ...
580
-			if ( preg_match( '/(?:")([^"]+)(?:"\s*=>)/', $replacement, $match ) ) {
580
+			if (preg_match('/(?:")([^"]+)(?:"\s*=>)/', $replacement, $match)) {
581 581
 				$key = $match[1];
582
-			} elseif ( preg_match( "/(?:')([^']+)(?:'\s*=>)/", $replacement, $match ) ) {
582
+			} elseif (preg_match("/(?:')([^']+)(?:'\s*=>)/", $replacement, $match)) {
583 583
 				$key = $match[1];
584 584
 			}
585 585
 
586 586
 			// ... and values.
587
-			if ( preg_match( '/(?:=>\s*")([^"]+)(?:")/', $replacement, $match ) ) {
587
+			if (preg_match('/(?:=>\s*")([^"]+)(?:")/', $replacement, $match)) {
588 588
 				$replacement = $match[1];
589
-			} elseif ( preg_match( "/(?:=>\s*')([^']+)(?:')/", $replacement, $match ) ) {
589
+			} elseif (preg_match("/(?:=>\s*')([^']+)(?:')/", $replacement, $match)) {
590 590
 				$replacement = $match[1];
591 591
 			}
592 592
 
593
-			return [ $key, $replacement ];
594
-		}, preg_split( '/,/', $custom_replacements, -1, PREG_SPLIT_NO_EMPTY ) );
593
+			return [$key, $replacement];
594
+		}, preg_split('/,/', $custom_replacements, -1, PREG_SPLIT_NO_EMPTY));
595 595
 	}
596 596
 
597 597
 	/**
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 		$patterns = [];
605 605
 		$replacements = [];
606 606
 
607
-		if ( ! empty( $this->data['diacriticCustomReplacements'] ) ) {
608
-			$this->parse_diacritics_rules( $this->data['diacriticCustomReplacements'], $patterns, $replacements );
607
+		if ( ! empty($this->data['diacriticCustomReplacements'])) {
608
+			$this->parse_diacritics_rules($this->data['diacriticCustomReplacements'], $patterns, $replacements);
609 609
 		}
610
-		if ( ! empty( $this->data['diacriticWords'] ) ) {
611
-			$this->parse_diacritics_rules( $this->data['diacriticWords'], $patterns, $replacements );
610
+		if ( ! empty($this->data['diacriticWords'])) {
611
+			$this->parse_diacritics_rules($this->data['diacriticWords'], $patterns, $replacements);
612 612
 		}
613 613
 
614 614
 		$this->data['diacriticReplacement'] = [
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 	 * @param array $patterns         Resulting patterns. Passed by reference.
625 625
 	 * @param array $replacements     Resulting replacements. Passed by reference.
626 626
 	 */
627
-	private function parse_diacritics_rules( array $diacritics_rules, array &$patterns, array &$replacements ) {
627
+	private function parse_diacritics_rules(array $diacritics_rules, array &$patterns, array &$replacements) {
628 628
 
629
-		foreach ( $diacritics_rules as $needle => $replacement ) {
629
+		foreach ($diacritics_rules as $needle => $replacement) {
630 630
 			$patterns[] = '/\b(?<!\w[' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . '])' . $needle . '\b(?![' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . ']\w)/u';
631
-			$replacements[ $needle ] = $replacement;
631
+			$replacements[$needle] = $replacement;
632 632
 		}
633 633
 	}
634 634
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 	 *
638 638
 	 * @param bool $on Optional. Default true.
639 639
 	 */
640
-	public function set_smart_marks( $on = true ) {
640
+	public function set_smart_marks($on = true) {
641 641
 		$this->data['smartMarks'] = $on;
642 642
 	}
643 643
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 *
647 647
 	 * @param bool $on Optional. Default true.
648 648
 	 */
649
-	public function set_smart_math( $on = true ) {
649
+	public function set_smart_math($on = true) {
650 650
 		$this->data['smartMath'] = $on;
651 651
 	}
652 652
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 *
656 656
 	 * @param bool $on Optional. Default true.
657 657
 	 */
658
-	public function set_smart_exponents( $on = true ) {
658
+	public function set_smart_exponents($on = true) {
659 659
 		$this->data['smartExponents'] = $on;
660 660
 	}
661 661
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @param bool $on Optional. Default true.
666 666
 	 */
667
-	public function set_smart_fractions( $on = true ) {
667
+	public function set_smart_fractions($on = true) {
668 668
 		$this->data['smartFractions'] = $on;
669 669
 	}
670 670
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	 *
674 674
 	 * @param bool $on Optional. Default true.
675 675
 	 */
676
-	public function set_smart_ordinal_suffix( $on = true ) {
676
+	public function set_smart_ordinal_suffix($on = true) {
677 677
 		$this->data['smartOrdinalSuffix'] = $on;
678 678
 	}
679 679
 
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	 *
683 683
 	 * @param bool $on Optional. Default true.
684 684
 	 */
685
-	public function set_single_character_word_spacing( $on = true ) {
685
+	public function set_single_character_word_spacing($on = true) {
686 686
 		$this->data['singleCharacterWordSpacing'] = $on;
687 687
 	}
688 688
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 *
692 692
 	 * @param bool $on Optional. Default true.
693 693
 	 */
694
-	public function set_fraction_spacing( $on = true ) {
694
+	public function set_fraction_spacing($on = true) {
695 695
 		$this->data['fractionSpacing'] = $on;
696 696
 	}
697 697
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @param bool $on Optional. Default true.
702 702
 	 */
703
-	public function set_unit_spacing( $on = true ) {
703
+	public function set_unit_spacing($on = true) {
704 704
 		$this->data['unitSpacing'] = $on;
705 705
 	}
706 706
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @param bool $on Optional. Default true.
711 711
 	 */
712
-	public function set_numbered_abbreviation_spacing( $on = true ) {
712
+	public function set_numbered_abbreviation_spacing($on = true) {
713 713
 		$this->data['numberedAbbreviationSpacing'] = $on;
714 714
 	}
715 715
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 	 *
719 719
 	 * @param bool $on Optional. Default true.
720 720
 	 */
721
-	public function set_french_punctuation_spacing( $on = true ) {
721
+	public function set_french_punctuation_spacing($on = true) {
722 722
 		$this->data['frenchPunctuationSpacing'] = $on;
723 723
 	}
724 724
 
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @param string|array $units A comma separated list or an array of units.
729 729
 	 */
730
-	public function set_units( $units = [] ) {
731
-		$this->data['units'] = Strings::maybe_split_parameters( $units );
732
-		$this->update_unit_pattern( $this->data['units'] );
730
+	public function set_units($units = []) {
731
+		$this->data['units'] = Strings::maybe_split_parameters($units);
732
+		$this->update_unit_pattern($this->data['units']);
733 733
 	}
734 734
 
735 735
 	/**
@@ -737,14 +737,14 @@  discard block
 block discarded – undo
737 737
 	 *
738 738
 	 * @param array $units An array of unit names.
739 739
 	 */
740
-	private function update_unit_pattern( array $units ) {
740
+	private function update_unit_pattern(array $units) {
741 741
 		// Update components & regex pattern.
742
-		foreach ( $units as $index => $unit ) {
742
+		foreach ($units as $index => $unit) {
743 743
 			// Escape special chars.
744
-			$units[ $index ] = preg_replace( '#([\[\\\^\$\.\|\?\*\+\(\)\{\}])#', '\\\\$1', $unit );
744
+			$units[$index] = preg_replace('#([\[\\\^\$\.\|\?\*\+\(\)\{\}])#', '\\\\$1', $unit);
745 745
 		}
746
-		$this->custom_units = implode( '|', $units );
747
-		$this->custom_units .= ( $this->custom_units ) ? '|' : '';
746
+		$this->custom_units = implode('|', $units);
747
+		$this->custom_units .= ($this->custom_units) ? '|' : '';
748 748
 	}
749 749
 
750 750
 	/**
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	 *
753 753
 	 * @param bool $on Optional. Default true.
754 754
 	 */
755
-	public function set_dash_spacing( $on = true ) {
755
+	public function set_dash_spacing($on = true) {
756 756
 		$this->data['dashSpacing'] = $on;
757 757
 	}
758 758
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	 *
762 762
 	 * @param bool $on Optional. Default true.
763 763
 	 */
764
-	public function set_space_collapse( $on = true ) {
764
+	public function set_space_collapse($on = true) {
765 765
 		$this->data['spaceCollapse'] = $on;
766 766
 	}
767 767
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	 *
771 771
 	 * @param bool $on Optional. Default true.
772 772
 	 */
773
-	public function set_dewidow( $on = true ) {
773
+	public function set_dewidow($on = true) {
774 774
 		$this->data['dewidow'] = $on;
775 775
 	}
776 776
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 	 *
780 780
 	 * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default.
781 781
 	 */
782
-	public function set_max_dewidow_length( $length = 5 ) {
783
-		$length = ( $length > 1 ) ? $length : 5;
782
+	public function set_max_dewidow_length($length = 5) {
783
+		$length = ($length > 1) ? $length : 5;
784 784
 
785 785
 		$this->data['dewidowMaxLength'] = $length;
786 786
 	}
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 	 *
791 791
 	 * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default.
792 792
 	 */
793
-	public function set_max_dewidow_pull( $length = 5 ) {
794
-		$length = ( $length > 1 ) ? $length : 5;
793
+	public function set_max_dewidow_pull($length = 5) {
794
+		$length = ($length > 1) ? $length : 5;
795 795
 
796 796
 		$this->data['dewidowMaxPull'] = $length;
797 797
 	}
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 *
802 802
 	 * @param bool $on Optional. Default true.
803 803
 	 */
804
-	public function set_wrap_hard_hyphens( $on = true ) {
804
+	public function set_wrap_hard_hyphens($on = true) {
805 805
 		$this->data['hyphenHardWrap'] = $on;
806 806
 	}
807 807
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 *
811 811
 	 * @param bool $on Optional. Default true.
812 812
 	 */
813
-	public function set_url_wrap( $on = true ) {
813
+	public function set_url_wrap($on = true) {
814 814
 		$this->data['urlWrap'] = $on;
815 815
 	}
816 816
 
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 *
820 820
 	 * @param bool $on Optional. Default true.
821 821
 	 */
822
-	public function set_email_wrap( $on = true ) {
822
+	public function set_email_wrap($on = true) {
823 823
 		$this->data['emailWrap'] = $on;
824 824
 	}
825 825
 
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
 	 *
829 829
 	 * @param int $length Defaults to 5. Trying to set the value to less than 1 resets the length to the default.
830 830
 	 */
831
-	public function set_min_after_url_wrap( $length = 5 ) {
832
-		$length = ( $length > 0 ) ? $length : 5;
831
+	public function set_min_after_url_wrap($length = 5) {
832
+		$length = ($length > 0) ? $length : 5;
833 833
 
834 834
 		$this->data['urlMinAfterWrap'] = $length;
835 835
 	}
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @param bool $on Optional. Default true.
841 841
 	 */
842
-	public function set_style_ampersands( $on = true ) {
842
+	public function set_style_ampersands($on = true) {
843 843
 		$this->data['styleAmpersands'] = $on;
844 844
 	}
845 845
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @param bool $on Optional. Default true.
850 850
 	 */
851
-	public function set_style_caps( $on = true ) {
851
+	public function set_style_caps($on = true) {
852 852
 		$this->data['styleCaps'] = $on;
853 853
 	}
854 854
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 	 *
858 858
 	 * @param bool $on Optional. Default true.
859 859
 	 */
860
-	public function set_style_initial_quotes( $on = true ) {
860
+	public function set_style_initial_quotes($on = true) {
861 861
 		$this->data['styleInitialQuotes'] = $on;
862 862
 	}
863 863
 
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @param bool $on Optional. Default true.
868 868
 	 */
869
-	public function set_style_numbers( $on = true ) {
869
+	public function set_style_numbers($on = true) {
870 870
 		$this->data['styleNumbers'] = $on;
871 871
 	}
872 872
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @param bool $on Optional. Default true.
877 877
 	 */
878
-	public function set_style_hanging_punctuation( $on = true ) {
878
+	public function set_style_hanging_punctuation($on = true) {
879 879
 		$this->data['styleHangingPunctuation'] = $on;
880 880
 	}
881 881
 
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 	 *
885 885
 	 * @param string|array $tags A comma separated list or an array of tag names.
886 886
 	 */
887
-	public function set_initial_quote_tags( $tags = [ 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'li', 'dd', 'dt' ] ) {
887
+	public function set_initial_quote_tags($tags = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'li', 'dd', 'dt']) {
888 888
 		// Make array if handed a list of tags as a string.
889
-		if ( ! is_array( $tags ) ) {
890
-			$tags = preg_split( '/[^a-z0-9]+/', $tags, -1, PREG_SPLIT_NO_EMPTY );
889
+		if ( ! is_array($tags)) {
890
+			$tags = preg_split('/[^a-z0-9]+/', $tags, -1, PREG_SPLIT_NO_EMPTY);
891 891
 		}
892 892
 
893 893
 		// Store the tag array inverted (with the tagName as its index for faster lookup).
894
-		$this->data['initialQuoteTags'] = array_change_key_case( array_flip( $tags ), CASE_LOWER );
894
+		$this->data['initialQuoteTags'] = array_change_key_case(array_flip($tags), CASE_LOWER);
895 895
 	}
896 896
 
897 897
 	/**
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	 *
900 900
 	 * @param bool $on Optional. Default true.
901 901
 	 */
902
-	public function set_hyphenation( $on = true ) {
902
+	public function set_hyphenation($on = true) {
903 903
 		$this->data['hyphenation'] = $on;
904 904
 	}
905 905
 
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 	 *
909 909
 	 * @param string $lang Has to correspond to a filename in 'lang'. Optional. Default 'en-US'.
910 910
 	 */
911
-	public function set_hyphenation_language( $lang = 'en-US' ) {
912
-		if ( isset( $this->data['hyphenLanguage'] ) && $this->data['hyphenLanguage'] === $lang ) {
911
+	public function set_hyphenation_language($lang = 'en-US') {
912
+		if (isset($this->data['hyphenLanguage']) && $this->data['hyphenLanguage'] === $lang) {
913 913
 			return; // Bail out, no need to do anything.
914 914
 		}
915 915
 
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
 	 *
922 922
 	 * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default.
923 923
 	 */
924
-	public function set_min_length_hyphenation( $length = 5 ) {
925
-		$length = ( $length > 1 ) ? $length : 5;
924
+	public function set_min_length_hyphenation($length = 5) {
925
+		$length = ($length > 1) ? $length : 5;
926 926
 
927 927
 		$this->data['hyphenMinLength'] = $length;
928 928
 	}
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
 	 *
933 933
 	 * @param int $length Defaults to 3. Trying to set the value to less than 1 resets the length to the default.
934 934
 	 */
935
-	public function set_min_before_hyphenation( $length = 3 ) {
936
-		$length = ( $length > 0 ) ? $length : 3;
935
+	public function set_min_before_hyphenation($length = 3) {
936
+		$length = ($length > 0) ? $length : 3;
937 937
 
938 938
 		$this->data['hyphenMinBefore'] = $length;
939 939
 	}
@@ -943,8 +943,8 @@  discard block
 block discarded – undo
943 943
 	 *
944 944
 	 * @param int $length Defaults to 2. Trying to set the value to less than 1 resets the length to the default.
945 945
 	 */
946
-	public function set_min_after_hyphenation( $length = 2 ) {
947
-		$length = ( $length > 0 ) ? $length : 2;
946
+	public function set_min_after_hyphenation($length = 2) {
947
+		$length = ($length > 0) ? $length : 2;
948 948
 
949 949
 		$this->data['hyphenMinAfter'] = $length;
950 950
 	}
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 *
955 955
 	 * @param bool $on Optional. Default true.
956 956
 	 */
957
-	public function set_hyphenate_headings( $on = true ) {
957
+	public function set_hyphenate_headings($on = true) {
958 958
 		$this->data['hyphenateTitle'] = $on;
959 959
 	}
960 960
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 *
964 964
 	 * @param bool $on Optional. Default true.
965 965
 	 */
966
-	public function set_hyphenate_all_caps( $on = true ) {
966
+	public function set_hyphenate_all_caps($on = true) {
967 967
 		$this->data['hyphenateAllCaps'] = $on;
968 968
 	}
969 969
 
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	 *
973 973
 	 * @param bool $on Optional. Default true.
974 974
 	 */
975
-	public function set_hyphenate_title_case( $on = true ) {
975
+	public function set_hyphenate_title_case($on = true) {
976 976
 		$this->data['hyphenateTitleCase'] = $on;
977 977
 	}
978 978
 
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 	 *
982 982
 	 * @param bool $on Optional. Default true.
983 983
 	 */
984
-	public function set_hyphenate_compounds( $on = true ) {
984
+	public function set_hyphenate_compounds($on = true) {
985 985
 		$this->data['hyphenateCompounds'] = $on;
986 986
 	}
987 987
 
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
 	 * @param string|array $exceptions An array of words with all hyphenation points marked with a hard hyphen (or a string list of such words).
992 992
 	 *        In the latter case, only alphanumeric characters and hyphens are recognized. The default is empty.
993 993
 	 */
994
-	public function set_hyphenation_exceptions( $exceptions = [] ) {
995
-		$this->data['hyphenationCustomExceptions'] = Strings::maybe_split_parameters( $exceptions );
994
+	public function set_hyphenation_exceptions($exceptions = []) {
995
+		$this->data['hyphenationCustomExceptions'] = Strings::maybe_split_parameters($exceptions);
996 996
 	}
997 997
 
998 998
 	/**
@@ -1002,11 +1002,11 @@  discard block
 block discarded – undo
1002 1002
 	 *
1003 1003
 	 * @return string A binary hash value for the current settings limited to $max_length.
1004 1004
 	 */
1005
-	public function get_hash( $max_length = 16 ) {
1006
-		$hash = md5( json_encode( $this->data ), true );
1005
+	public function get_hash($max_length = 16) {
1006
+		$hash = md5(json_encode($this->data), true);
1007 1007
 
1008
-		if ( $max_length < strlen( $hash ) ) {
1009
-			$hash = substr( $hash, 0, $max_length );
1008
+		if ($max_length < strlen($hash)) {
1009
+			$hash = substr($hash, 0, $max_length);
1010 1010
 		}
1011 1011
 
1012 1012
 		return $hash;
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.