@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function setHTML($html) |
| 177 | 177 | { |
| 178 | 178 | // strip style definitions, if we use css-class "cleanup" on a style-element |
| 179 | - $this->html = (string)preg_replace(self::$styleTagWithCleanupClassRegEx, ' ', $html); |
|
| 179 | + $this->html = (string) preg_replace(self::$styleTagWithCleanupClassRegEx, ' ', $html); |
|
| 180 | 180 | |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function setCSS($css) |
| 192 | 192 | { |
| 193 | - $this->css = (string)$css; |
|
| 193 | + $this->css = (string) $css; |
|
| 194 | 194 | |
| 195 | 195 | $this->css_media_queries = $this->getMediaQueries($css); |
| 196 | 196 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | public function convert($outputXHTML = false, $libXMLExtraOptions = null, $path = false) |
| 237 | 237 | { |
| 238 | 238 | // init |
| 239 | - $outputXHTML = (bool)$outputXHTML; |
|
| 239 | + $outputXHTML = (bool) $outputXHTML; |
|
| 240 | 240 | |
| 241 | 241 | // validate |
| 242 | 242 | if (!$this->html) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if ($this->loadCSSFromHTML) { |
| 254 | 254 | foreach ($dom->find('link') as $node) { |
| 255 | 255 | |
| 256 | - $file = ($path ?: __DIR__) . '/' . $node->getAttribute('href'); |
|
| 256 | + $file = ($path ?: __DIR__).'/'.$node->getAttribute('href'); |
|
| 257 | 257 | |
| 258 | 258 | if (file_exists($file)) { |
| 259 | 259 | $css .= file_get_contents($file); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | && |
| 305 | 305 | $this->css_media_queries |
| 306 | 306 | ) { |
| 307 | - $html = str_ireplace('</head>', '<style type="text/css">' . "\n" . $this->css_media_queries . "\n" . '</styles></head>', $html); |
|
| 307 | + $html = str_ireplace('</head>', '<style type="text/css">'."\n".$this->css_media_queries."\n".'</styles></head>', $html); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | return $html; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if (!empty($matches[1])) { |
| 333 | 333 | // add |
| 334 | 334 | foreach ($matches[1] as $match) { |
| 335 | - $css .= trim($match) . "\n"; |
|
| 335 | + $css .= trim($match)."\n"; |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -352,12 +352,12 @@ discard block |
||
| 352 | 352 | $cssRules = array(); |
| 353 | 353 | |
| 354 | 354 | // init vars |
| 355 | - $css = (string)$css; |
|
| 355 | + $css = (string) $css; |
|
| 356 | 356 | |
| 357 | 357 | $css = $this->doCleanup($css); |
| 358 | 358 | |
| 359 | 359 | // rules are splitted by } |
| 360 | - $rules = (array)explode('}', $css); |
|
| 360 | + $rules = (array) explode('}', $css); |
|
| 361 | 361 | |
| 362 | 362 | // init var |
| 363 | 363 | $i = 1; |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $cssProperties = trim($chunks[1]); |
| 380 | 380 | |
| 381 | 381 | // split multiple selectors |
| 382 | - $selectors = (array)explode(',', $selectors); |
|
| 382 | + $selectors = (array) explode(',', $selectors); |
|
| 383 | 383 | |
| 384 | 384 | // loop selectors |
| 385 | 385 | foreach ($selectors as $selector) { |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $css = $this->stripeMediaQueries($css); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - return (string)$css; |
|
| 450 | + return (string) $css; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | // remove comments previously to matching media queries |
| 463 | 463 | $css = preg_replace(self::$styleCommentRegEx, '', $css); |
| 464 | 464 | |
| 465 | - return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css); |
|
| 465 | + return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | private function stripeCharsetInCss($css) |
| 493 | 493 | { |
| 494 | - return (string)preg_replace(self::$cssCharsetRegEx, '', $css); |
|
| 494 | + return (string) preg_replace(self::$cssCharsetRegEx, '', $css); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /** |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | // loop properties |
| 513 | 513 | foreach ($properties as $property) { |
| 514 | 514 | // split into chunks |
| 515 | - $chunks = (array)explode(':', $property, 2); |
|
| 515 | + $chunks = (array) explode(':', $property, 2); |
|
| 516 | 516 | |
| 517 | 517 | // validate |
| 518 | 518 | if (!isset($chunks[1])) { |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | */ |
| 551 | 551 | private function splitIntoProperties($styles) |
| 552 | 552 | { |
| 553 | - $properties = (array)explode(';', $styles); |
|
| 553 | + $properties = (array) explode(';', $styles); |
|
| 554 | 554 | $propertiesCount = count($properties); |
| 555 | 555 | |
| 556 | 556 | /** @noinspection ForeachInvariantsInspection */ |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | && |
| 563 | 563 | strpos($properties[$i + 1], 'base64,') !== false |
| 564 | 564 | ) { |
| 565 | - $properties[$i] .= ';' . $properties[$i + 1]; |
|
| 565 | + $properties[$i] .= ';'.$properties[$i + 1]; |
|
| 566 | 566 | $properties[$i + 1] = ''; |
| 567 | 567 | ++$i; |
| 568 | 568 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | $originalStyle = $element->attributes->getNamedItem('style'); |
| 646 | 646 | |
| 647 | 647 | if ($originalStyle) { |
| 648 | - $originalStyle = (string)$originalStyle->value; |
|
| 648 | + $originalStyle = (string) $originalStyle->value; |
|
| 649 | 649 | } else { |
| 650 | 650 | $originalStyle = ''; |
| 651 | 651 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | // any styles defined before? |
| 701 | 701 | if (null !== $stylesAttribute) { |
| 702 | 702 | // get value for the styles attribute |
| 703 | - $definedStyles = (string)$stylesAttribute->value; |
|
| 703 | + $definedStyles = (string) $stylesAttribute->value; |
|
| 704 | 704 | |
| 705 | 705 | // split into properties |
| 706 | 706 | $definedProperties = $this->splitIntoProperties($definedStyles); |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | || |
| 718 | 718 | false === stripos($properties[$key], '!important') |
| 719 | 719 | || |
| 720 | - false !== stripos(implode('', (array)$value), '!important') |
|
| 720 | + false !== stripos(implode('', (array) $value), '!important') |
|
| 721 | 721 | ) { |
| 722 | 722 | unset($properties[$key]); |
| 723 | 723 | $properties[$key] = $value; |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | |
| 730 | 730 | // build chunks |
| 731 | 731 | foreach ($properties as $key => $values) { |
| 732 | - foreach ((array)$values as $value) { |
|
| 733 | - $propertyChunks[] = $key . ': ' . $value . ';'; |
|
| 732 | + foreach ((array) $values as $value) { |
|
| 733 | + $propertyChunks[] = $key.': '.$value.';'; |
|
| 734 | 734 | } |
| 735 | 735 | } |
| 736 | 736 | |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | // split into chunks |
| 762 | - $chunks = (array)explode(':', trim($property), 2); |
|
| 762 | + $chunks = (array) explode(':', trim($property), 2); |
|
| 763 | 763 | |
| 764 | 764 | // validate |
| 765 | 765 | if (!isset($chunks[1])) { |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | public function setCleanup($on = true) |
| 825 | 825 | { |
| 826 | - $this->cleanup = (bool)$on; |
|
| 826 | + $this->cleanup = (bool) $on; |
|
| 827 | 827 | |
| 828 | 828 | return $this; |
| 829 | 829 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | */ |
| 840 | 840 | public function setEncoding($encoding) |
| 841 | 841 | { |
| 842 | - $this->encoding = (string)$encoding; |
|
| 842 | + $this->encoding = (string) $encoding; |
|
| 843 | 843 | |
| 844 | 844 | return $this; |
| 845 | 845 | } |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | */ |
| 856 | 856 | public function setUseInlineStylesBlock($on = true) |
| 857 | 857 | { |
| 858 | - $this->useInlineStylesBlock = (bool)$on; |
|
| 858 | + $this->useInlineStylesBlock = (bool) $on; |
|
| 859 | 859 | |
| 860 | 860 | return $this; |
| 861 | 861 | } |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | */ |
| 872 | 872 | public function setLoadCSSFromHTML($on = true) |
| 873 | 873 | { |
| 874 | - $this->loadCSSFromHTML = (bool)$on; |
|
| 874 | + $this->loadCSSFromHTML = (bool) $on; |
|
| 875 | 875 | |
| 876 | 876 | return $this; |
| 877 | 877 | } |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | */ |
| 888 | 888 | public function setStripOriginalStyleTags($on = true) |
| 889 | 889 | { |
| 890 | - $this->stripOriginalStyleTags = (bool)$on; |
|
| 890 | + $this->stripOriginalStyleTags = (bool) $on; |
|
| 891 | 891 | |
| 892 | 892 | return $this; |
| 893 | 893 | } |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | */ |
| 906 | 906 | public function setExcludeMediaQueries($on = true) |
| 907 | 907 | { |
| 908 | - $this->excludeMediaQueries = (bool)$on; |
|
| 908 | + $this->excludeMediaQueries = (bool) $on; |
|
| 909 | 909 | |
| 910 | 910 | return $this; |
| 911 | 911 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | */ |
| 920 | 920 | public function setExcludeCssCharset($on = true) |
| 921 | 921 | { |
| 922 | - $this->excludeCssCharset = (bool)$on; |
|
| 922 | + $this->excludeCssCharset = (bool) $on; |
|
| 923 | 923 | |
| 924 | 924 | return $this; |
| 925 | 925 | } |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | public function setExcludeConditionalInlineStylesBlock($on = true) |
| 937 | 937 | { |
| 938 | - $this->excludeConditionalInlineStylesBlock = (bool)$on; |
|
| 938 | + $this->excludeConditionalInlineStylesBlock = (bool) $on; |
|
| 939 | 939 | |
| 940 | 940 | return $this; |
| 941 | 941 | } |