We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -98,8 +98,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,21 +573,21 @@ discard block |
||
| 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( '/("|\')((?:(?!\1).)+)(?:\1\s*=>)/', $replacement, $match ) ) { |
|
| 580 | + if (preg_match('/("|\')((?:(?!\1).)+)(?:\1\s*=>)/', $replacement, $match)) { |
|
| 581 | 581 | $key = $match[2]; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | // ... and values. |
| 585 | - if ( preg_match( '/(?:=>\s*("|\'))((?:(?!\1).)+)(?:\1)/', $replacement, $match ) ) { |
|
| 585 | + if (preg_match('/(?:=>\s*("|\'))((?:(?!\1).)+)(?:\1)/', $replacement, $match)) { |
|
| 586 | 586 | $replacement = $match[2]; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - return [ $key, $replacement ]; |
|
| 590 | - }, preg_split( '/,/', $custom_replacements, -1, PREG_SPLIT_NO_EMPTY ) ); |
|
| 589 | + return [$key, $replacement]; |
|
| 590 | + }, preg_split('/,/', $custom_replacements, -1, PREG_SPLIT_NO_EMPTY)); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -600,11 +600,11 @@ discard block |
||
| 600 | 600 | $patterns = []; |
| 601 | 601 | $replacements = []; |
| 602 | 602 | |
| 603 | - if ( ! empty( $this->data['diacriticCustomReplacements'] ) ) { |
|
| 604 | - $this->parse_diacritics_rules( $this->data['diacriticCustomReplacements'], $patterns, $replacements ); |
|
| 603 | + if ( ! empty($this->data['diacriticCustomReplacements'])) { |
|
| 604 | + $this->parse_diacritics_rules($this->data['diacriticCustomReplacements'], $patterns, $replacements); |
|
| 605 | 605 | } |
| 606 | - if ( ! empty( $this->data['diacriticWords'] ) ) { |
|
| 607 | - $this->parse_diacritics_rules( $this->data['diacriticWords'], $patterns, $replacements ); |
|
| 606 | + if ( ! empty($this->data['diacriticWords'])) { |
|
| 607 | + $this->parse_diacritics_rules($this->data['diacriticWords'], $patterns, $replacements); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | $this->data['diacriticReplacement'] = [ |
@@ -620,11 +620,11 @@ discard block |
||
| 620 | 620 | * @param array $patterns Resulting patterns. Passed by reference. |
| 621 | 621 | * @param array $replacements Resulting replacements. Passed by reference. |
| 622 | 622 | */ |
| 623 | - private function parse_diacritics_rules( array $diacritics_rules, array &$patterns, array &$replacements ) { |
|
| 623 | + private function parse_diacritics_rules(array $diacritics_rules, array &$patterns, array &$replacements) { |
|
| 624 | 624 | |
| 625 | - foreach ( $diacritics_rules as $needle => $replacement ) { |
|
| 625 | + foreach ($diacritics_rules as $needle => $replacement) { |
|
| 626 | 626 | $patterns[] = '/\b(?<!\w[' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . '])' . $needle . '\b(?![' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . ']\w)/u'; |
| 627 | - $replacements[ $needle ] = $replacement; |
|
| 627 | + $replacements[$needle] = $replacement; |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * |
| 634 | 634 | * @param bool $on Optional. Default true. |
| 635 | 635 | */ |
| 636 | - public function set_smart_marks( $on = true ) { |
|
| 636 | + public function set_smart_marks($on = true) { |
|
| 637 | 637 | $this->data['smartMarks'] = $on; |
| 638 | 638 | } |
| 639 | 639 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * |
| 643 | 643 | * @param bool $on Optional. Default true. |
| 644 | 644 | */ |
| 645 | - public function set_smart_math( $on = true ) { |
|
| 645 | + public function set_smart_math($on = true) { |
|
| 646 | 646 | $this->data['smartMath'] = $on; |
| 647 | 647 | } |
| 648 | 648 | |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | * |
| 652 | 652 | * @param bool $on Optional. Default true. |
| 653 | 653 | */ |
| 654 | - public function set_smart_exponents( $on = true ) { |
|
| 654 | + public function set_smart_exponents($on = true) { |
|
| 655 | 655 | $this->data['smartExponents'] = $on; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | * |
| 661 | 661 | * @param bool $on Optional. Default true. |
| 662 | 662 | */ |
| 663 | - public function set_smart_fractions( $on = true ) { |
|
| 663 | + public function set_smart_fractions($on = true) { |
|
| 664 | 664 | $this->data['smartFractions'] = $on; |
| 665 | 665 | } |
| 666 | 666 | |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | * |
| 670 | 670 | * @param bool $on Optional. Default true. |
| 671 | 671 | */ |
| 672 | - public function set_smart_ordinal_suffix( $on = true ) { |
|
| 672 | + public function set_smart_ordinal_suffix($on = true) { |
|
| 673 | 673 | $this->data['smartOrdinalSuffix'] = $on; |
| 674 | 674 | } |
| 675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | * |
| 679 | 679 | * @param bool $on Optional. Default true. |
| 680 | 680 | */ |
| 681 | - public function set_single_character_word_spacing( $on = true ) { |
|
| 681 | + public function set_single_character_word_spacing($on = true) { |
|
| 682 | 682 | $this->data['singleCharacterWordSpacing'] = $on; |
| 683 | 683 | } |
| 684 | 684 | |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | * |
| 688 | 688 | * @param bool $on Optional. Default true. |
| 689 | 689 | */ |
| 690 | - public function set_fraction_spacing( $on = true ) { |
|
| 690 | + public function set_fraction_spacing($on = true) { |
|
| 691 | 691 | $this->data['fractionSpacing'] = $on; |
| 692 | 692 | } |
| 693 | 693 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | * |
| 697 | 697 | * @param bool $on Optional. Default true. |
| 698 | 698 | */ |
| 699 | - public function set_unit_spacing( $on = true ) { |
|
| 699 | + public function set_unit_spacing($on = true) { |
|
| 700 | 700 | $this->data['unitSpacing'] = $on; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | * |
| 706 | 706 | * @param bool $on Optional. Default true. |
| 707 | 707 | */ |
| 708 | - public function set_numbered_abbreviation_spacing( $on = true ) { |
|
| 708 | + public function set_numbered_abbreviation_spacing($on = true) { |
|
| 709 | 709 | $this->data['numberedAbbreviationSpacing'] = $on; |
| 710 | 710 | } |
| 711 | 711 | |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @param bool $on Optional. Default true. |
| 716 | 716 | */ |
| 717 | - public function set_french_punctuation_spacing( $on = true ) { |
|
| 717 | + public function set_french_punctuation_spacing($on = true) { |
|
| 718 | 718 | $this->data['frenchPunctuationSpacing'] = $on; |
| 719 | 719 | } |
| 720 | 720 | |
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | * |
| 724 | 724 | * @param string|array $units A comma separated list or an array of units. |
| 725 | 725 | */ |
| 726 | - public function set_units( $units = [] ) { |
|
| 727 | - $this->data['units'] = Strings::maybe_split_parameters( $units ); |
|
| 728 | - $this->update_unit_pattern( $this->data['units'] ); |
|
| 726 | + public function set_units($units = []) { |
|
| 727 | + $this->data['units'] = Strings::maybe_split_parameters($units); |
|
| 728 | + $this->update_unit_pattern($this->data['units']); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -733,14 +733,14 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @param array $units An array of unit names. |
| 735 | 735 | */ |
| 736 | - private function update_unit_pattern( array $units ) { |
|
| 736 | + private function update_unit_pattern(array $units) { |
|
| 737 | 737 | // Update components & regex pattern. |
| 738 | - foreach ( $units as $index => $unit ) { |
|
| 738 | + foreach ($units as $index => $unit) { |
|
| 739 | 739 | // Escape special chars. |
| 740 | - $units[ $index ] = preg_replace( '#([\[\\\^\$\.\|\?\*\+\(\)\{\}])#', '\\\\$1', $unit ); |
|
| 740 | + $units[$index] = preg_replace('#([\[\\\^\$\.\|\?\*\+\(\)\{\}])#', '\\\\$1', $unit); |
|
| 741 | 741 | } |
| 742 | - $this->custom_units = implode( '|', $units ); |
|
| 743 | - $this->custom_units .= ( $this->custom_units ) ? '|' : ''; |
|
| 742 | + $this->custom_units = implode('|', $units); |
|
| 743 | + $this->custom_units .= ($this->custom_units) ? '|' : ''; |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | * |
| 749 | 749 | * @param bool $on Optional. Default true. |
| 750 | 750 | */ |
| 751 | - public function set_dash_spacing( $on = true ) { |
|
| 751 | + public function set_dash_spacing($on = true) { |
|
| 752 | 752 | $this->data['dashSpacing'] = $on; |
| 753 | 753 | } |
| 754 | 754 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | * |
| 758 | 758 | * @param bool $on Optional. Default true. |
| 759 | 759 | */ |
| 760 | - public function set_space_collapse( $on = true ) { |
|
| 760 | + public function set_space_collapse($on = true) { |
|
| 761 | 761 | $this->data['spaceCollapse'] = $on; |
| 762 | 762 | } |
| 763 | 763 | |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | * |
| 767 | 767 | * @param bool $on Optional. Default true. |
| 768 | 768 | */ |
| 769 | - public function set_dewidow( $on = true ) { |
|
| 769 | + public function set_dewidow($on = true) { |
|
| 770 | 770 | $this->data['dewidow'] = $on; |
| 771 | 771 | } |
| 772 | 772 | |
@@ -775,8 +775,8 @@ discard block |
||
| 775 | 775 | * |
| 776 | 776 | * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default. |
| 777 | 777 | */ |
| 778 | - public function set_max_dewidow_length( $length = 5 ) { |
|
| 779 | - $length = ( $length > 1 ) ? $length : 5; |
|
| 778 | + public function set_max_dewidow_length($length = 5) { |
|
| 779 | + $length = ($length > 1) ? $length : 5; |
|
| 780 | 780 | |
| 781 | 781 | $this->data['dewidowMaxLength'] = $length; |
| 782 | 782 | } |
@@ -786,8 +786,8 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default. |
| 788 | 788 | */ |
| 789 | - public function set_max_dewidow_pull( $length = 5 ) { |
|
| 790 | - $length = ( $length > 1 ) ? $length : 5; |
|
| 789 | + public function set_max_dewidow_pull($length = 5) { |
|
| 790 | + $length = ($length > 1) ? $length : 5; |
|
| 791 | 791 | |
| 792 | 792 | $this->data['dewidowMaxPull'] = $length; |
| 793 | 793 | } |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | * |
| 798 | 798 | * @param bool $on Optional. Default true. |
| 799 | 799 | */ |
| 800 | - public function set_wrap_hard_hyphens( $on = true ) { |
|
| 800 | + public function set_wrap_hard_hyphens($on = true) { |
|
| 801 | 801 | $this->data['hyphenHardWrap'] = $on; |
| 802 | 802 | } |
| 803 | 803 | |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | * |
| 807 | 807 | * @param bool $on Optional. Default true. |
| 808 | 808 | */ |
| 809 | - public function set_url_wrap( $on = true ) { |
|
| 809 | + public function set_url_wrap($on = true) { |
|
| 810 | 810 | $this->data['urlWrap'] = $on; |
| 811 | 811 | } |
| 812 | 812 | |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | * |
| 816 | 816 | * @param bool $on Optional. Default true. |
| 817 | 817 | */ |
| 818 | - public function set_email_wrap( $on = true ) { |
|
| 818 | + public function set_email_wrap($on = true) { |
|
| 819 | 819 | $this->data['emailWrap'] = $on; |
| 820 | 820 | } |
| 821 | 821 | |
@@ -824,8 +824,8 @@ discard block |
||
| 824 | 824 | * |
| 825 | 825 | * @param int $length Defaults to 5. Trying to set the value to less than 1 resets the length to the default. |
| 826 | 826 | */ |
| 827 | - public function set_min_after_url_wrap( $length = 5 ) { |
|
| 828 | - $length = ( $length > 0 ) ? $length : 5; |
|
| 827 | + public function set_min_after_url_wrap($length = 5) { |
|
| 828 | + $length = ($length > 0) ? $length : 5; |
|
| 829 | 829 | |
| 830 | 830 | $this->data['urlMinAfterWrap'] = $length; |
| 831 | 831 | } |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | * |
| 836 | 836 | * @param bool $on Optional. Default true. |
| 837 | 837 | */ |
| 838 | - public function set_style_ampersands( $on = true ) { |
|
| 838 | + public function set_style_ampersands($on = true) { |
|
| 839 | 839 | $this->data['styleAmpersands'] = $on; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | * |
| 845 | 845 | * @param bool $on Optional. Default true. |
| 846 | 846 | */ |
| 847 | - public function set_style_caps( $on = true ) { |
|
| 847 | + public function set_style_caps($on = true) { |
|
| 848 | 848 | $this->data['styleCaps'] = $on; |
| 849 | 849 | } |
| 850 | 850 | |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | * |
| 854 | 854 | * @param bool $on Optional. Default true. |
| 855 | 855 | */ |
| 856 | - public function set_style_initial_quotes( $on = true ) { |
|
| 856 | + public function set_style_initial_quotes($on = true) { |
|
| 857 | 857 | $this->data['styleInitialQuotes'] = $on; |
| 858 | 858 | } |
| 859 | 859 | |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | * |
| 863 | 863 | * @param bool $on Optional. Default true. |
| 864 | 864 | */ |
| 865 | - public function set_style_numbers( $on = true ) { |
|
| 865 | + public function set_style_numbers($on = true) { |
|
| 866 | 866 | $this->data['styleNumbers'] = $on; |
| 867 | 867 | } |
| 868 | 868 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | * |
| 872 | 872 | * @param bool $on Optional. Default true. |
| 873 | 873 | */ |
| 874 | - public function set_style_hanging_punctuation( $on = true ) { |
|
| 874 | + public function set_style_hanging_punctuation($on = true) { |
|
| 875 | 875 | $this->data['styleHangingPunctuation'] = $on; |
| 876 | 876 | } |
| 877 | 877 | |
@@ -880,14 +880,14 @@ discard block |
||
| 880 | 880 | * |
| 881 | 881 | * @param string|array $tags A comma separated list or an array of tag names. |
| 882 | 882 | */ |
| 883 | - public function set_initial_quote_tags( $tags = [ 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'li', 'dd', 'dt' ] ) { |
|
| 883 | + public function set_initial_quote_tags($tags = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'li', 'dd', 'dt']) { |
|
| 884 | 884 | // Make array if handed a list of tags as a string. |
| 885 | - if ( ! is_array( $tags ) ) { |
|
| 886 | - $tags = preg_split( '/[^a-z0-9]+/', $tags, -1, PREG_SPLIT_NO_EMPTY ); |
|
| 885 | + if ( ! is_array($tags)) { |
|
| 886 | + $tags = preg_split('/[^a-z0-9]+/', $tags, -1, PREG_SPLIT_NO_EMPTY); |
|
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | // Store the tag array inverted (with the tagName as its index for faster lookup). |
| 890 | - $this->data['initialQuoteTags'] = array_change_key_case( array_flip( $tags ), CASE_LOWER ); |
|
| 890 | + $this->data['initialQuoteTags'] = array_change_key_case(array_flip($tags), CASE_LOWER); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | * |
| 896 | 896 | * @param bool $on Optional. Default true. |
| 897 | 897 | */ |
| 898 | - public function set_hyphenation( $on = true ) { |
|
| 898 | + public function set_hyphenation($on = true) { |
|
| 899 | 899 | $this->data['hyphenation'] = $on; |
| 900 | 900 | } |
| 901 | 901 | |
@@ -904,8 +904,8 @@ discard block |
||
| 904 | 904 | * |
| 905 | 905 | * @param string $lang Has to correspond to a filename in 'lang'. Optional. Default 'en-US'. |
| 906 | 906 | */ |
| 907 | - public function set_hyphenation_language( $lang = 'en-US' ) { |
|
| 908 | - if ( isset( $this->data['hyphenLanguage'] ) && $this->data['hyphenLanguage'] === $lang ) { |
|
| 907 | + public function set_hyphenation_language($lang = 'en-US') { |
|
| 908 | + if (isset($this->data['hyphenLanguage']) && $this->data['hyphenLanguage'] === $lang) { |
|
| 909 | 909 | return; // Bail out, no need to do anything. |
| 910 | 910 | } |
| 911 | 911 | |
@@ -917,8 +917,8 @@ discard block |
||
| 917 | 917 | * |
| 918 | 918 | * @param int $length Defaults to 5. Trying to set the value to less than 2 resets the length to the default. |
| 919 | 919 | */ |
| 920 | - public function set_min_length_hyphenation( $length = 5 ) { |
|
| 921 | - $length = ( $length > 1 ) ? $length : 5; |
|
| 920 | + public function set_min_length_hyphenation($length = 5) { |
|
| 921 | + $length = ($length > 1) ? $length : 5; |
|
| 922 | 922 | |
| 923 | 923 | $this->data['hyphenMinLength'] = $length; |
| 924 | 924 | } |
@@ -928,8 +928,8 @@ discard block |
||
| 928 | 928 | * |
| 929 | 929 | * @param int $length Defaults to 3. Trying to set the value to less than 1 resets the length to the default. |
| 930 | 930 | */ |
| 931 | - public function set_min_before_hyphenation( $length = 3 ) { |
|
| 932 | - $length = ( $length > 0 ) ? $length : 3; |
|
| 931 | + public function set_min_before_hyphenation($length = 3) { |
|
| 932 | + $length = ($length > 0) ? $length : 3; |
|
| 933 | 933 | |
| 934 | 934 | $this->data['hyphenMinBefore'] = $length; |
| 935 | 935 | } |
@@ -939,8 +939,8 @@ discard block |
||
| 939 | 939 | * |
| 940 | 940 | * @param int $length Defaults to 2. Trying to set the value to less than 1 resets the length to the default. |
| 941 | 941 | */ |
| 942 | - public function set_min_after_hyphenation( $length = 2 ) { |
|
| 943 | - $length = ( $length > 0 ) ? $length : 2; |
|
| 942 | + public function set_min_after_hyphenation($length = 2) { |
|
| 943 | + $length = ($length > 0) ? $length : 2; |
|
| 944 | 944 | |
| 945 | 945 | $this->data['hyphenMinAfter'] = $length; |
| 946 | 946 | } |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | * |
| 951 | 951 | * @param bool $on Optional. Default true. |
| 952 | 952 | */ |
| 953 | - public function set_hyphenate_headings( $on = true ) { |
|
| 953 | + public function set_hyphenate_headings($on = true) { |
|
| 954 | 954 | $this->data['hyphenateTitle'] = $on; |
| 955 | 955 | } |
| 956 | 956 | |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | * |
| 960 | 960 | * @param bool $on Optional. Default true. |
| 961 | 961 | */ |
| 962 | - public function set_hyphenate_all_caps( $on = true ) { |
|
| 962 | + public function set_hyphenate_all_caps($on = true) { |
|
| 963 | 963 | $this->data['hyphenateAllCaps'] = $on; |
| 964 | 964 | } |
| 965 | 965 | |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | * |
| 969 | 969 | * @param bool $on Optional. Default true. |
| 970 | 970 | */ |
| 971 | - public function set_hyphenate_title_case( $on = true ) { |
|
| 971 | + public function set_hyphenate_title_case($on = true) { |
|
| 972 | 972 | $this->data['hyphenateTitleCase'] = $on; |
| 973 | 973 | } |
| 974 | 974 | |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | * |
| 978 | 978 | * @param bool $on Optional. Default true. |
| 979 | 979 | */ |
| 980 | - public function set_hyphenate_compounds( $on = true ) { |
|
| 980 | + public function set_hyphenate_compounds($on = true) { |
|
| 981 | 981 | $this->data['hyphenateCompounds'] = $on; |
| 982 | 982 | } |
| 983 | 983 | |
@@ -987,8 +987,8 @@ discard block |
||
| 987 | 987 | * @param string|array $exceptions An array of words with all hyphenation points marked with a hard hyphen (or a string list of such words). |
| 988 | 988 | * In the latter case, only alphanumeric characters and hyphens are recognized. The default is empty. |
| 989 | 989 | */ |
| 990 | - public function set_hyphenation_exceptions( $exceptions = [] ) { |
|
| 991 | - $this->data['hyphenationCustomExceptions'] = Strings::maybe_split_parameters( $exceptions ); |
|
| 990 | + public function set_hyphenation_exceptions($exceptions = []) { |
|
| 991 | + $this->data['hyphenationCustomExceptions'] = Strings::maybe_split_parameters($exceptions); |
|
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | /** |
@@ -998,11 +998,11 @@ discard block |
||
| 998 | 998 | * |
| 999 | 999 | * @return string A binary hash value for the current settings limited to $max_length. |
| 1000 | 1000 | */ |
| 1001 | - public function get_hash( $max_length = 16 ) { |
|
| 1002 | - $hash = md5( json_encode( $this->data ), true ); |
|
| 1001 | + public function get_hash($max_length = 16) { |
|
| 1002 | + $hash = md5(json_encode($this->data), true); |
|
| 1003 | 1003 | |
| 1004 | - if ( $max_length < strlen( $hash ) ) { |
|
| 1005 | - $hash = substr( $hash, 0, $max_length ); |
|
| 1004 | + if ($max_length < strlen($hash)) { |
|
| 1005 | + $hash = substr($hash, 0, $max_length); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | return $hash; |