@@ -164,7 +164,7 @@ discard block  | 
                                                    ||
| 164 | 164 | public function setHTML($html)  | 
                                                        
| 165 | 165 |    { | 
                                                        
| 166 | 166 | // strip style definitions, if we use css-class "cleanup" on a style-element  | 
                                                        
| 167 | -    $this->html = (string)preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html); | 
                                                        |
| 167 | +    $this->html = (string) preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html); | 
                                                        |
| 168 | 168 | }  | 
                                                        
| 169 | 169 | |
| 170 | 170 | /**  | 
                                                        
@@ -174,7 +174,7 @@ discard block  | 
                                                    ||
| 174 | 174 | */  | 
                                                        
| 175 | 175 | public function setCSS($css)  | 
                                                        
| 176 | 176 |    { | 
                                                        
| 177 | - $this->css = (string)$css;  | 
                                                        |
| 177 | + $this->css = (string) $css;  | 
                                                        |
| 178 | 178 | }  | 
                                                        
| 179 | 179 | |
| 180 | 180 | /**  | 
                                                        
@@ -215,7 +215,7 @@ discard block  | 
                                                    ||
| 215 | 215 | public function convert($outputXHTML = false, $libXMLOptions = 0, $path = false)  | 
                                                        
| 216 | 216 |    { | 
                                                        
| 217 | 217 | // redefine  | 
                                                        
| 218 | - $outputXHTML = (bool)$outputXHTML;  | 
                                                        |
| 218 | + $outputXHTML = (bool) $outputXHTML;  | 
                                                        |
| 219 | 219 | |
| 220 | 220 | // validate  | 
                                                        
| 221 | 221 |      if (!$this->html) { | 
                                                        
@@ -233,7 +233,7 @@ discard block  | 
                                                    ||
| 233 | 233 |        foreach ($document->getElementsByTagName('link') as $node) { | 
                                                        
| 234 | 234 | |
| 235 | 235 | /** @noinspection PhpUndefinedMethodInspection */  | 
                                                        
| 236 | -        $file = ($path ?: __DIR__) . '/' . $node->getAttribute('href'); | 
                                                        |
| 236 | +        $file = ($path ?: __DIR__).'/'.$node->getAttribute('href'); | 
                                                        |
| 237 | 237 | |
| 238 | 238 |          if (file_exists($file)) { | 
                                                        
| 239 | 239 | $css .= file_get_contents($file);  | 
                                                        
@@ -310,7 +310,7 @@ discard block  | 
                                                    ||
| 310 | 310 |      if (!empty($matches[2])) { | 
                                                        
| 311 | 311 | // add  | 
                                                        
| 312 | 312 |        foreach ($matches[2] as $match) { | 
                                                        
| 313 | - $css .= trim($match) . "\n";  | 
                                                        |
| 313 | + $css .= trim($match)."\n";  | 
                                                        |
| 314 | 314 | }  | 
                                                        
| 315 | 315 | }  | 
                                                        
| 316 | 316 | |
@@ -330,12 +330,12 @@ discard block  | 
                                                    ||
| 330 | 330 | $cssRules = array();  | 
                                                        
| 331 | 331 | |
| 332 | 332 | // init vars  | 
                                                        
| 333 | - $css = (string)$css;  | 
                                                        |
| 333 | + $css = (string) $css;  | 
                                                        |
| 334 | 334 | |
| 335 | 335 | $css = $this->doCleanup($css);  | 
                                                        
| 336 | 336 | |
| 337 | 337 | // rules are splitted by }  | 
                                                        
| 338 | -    $rules = (array)explode('}', $css); | 
                                                        |
| 338 | +    $rules = (array) explode('}', $css); | 
                                                        |
| 339 | 339 | |
| 340 | 340 | // init var  | 
                                                        
| 341 | 341 | $i = 1;  | 
                                                        
@@ -357,7 +357,7 @@ discard block  | 
                                                    ||
| 357 | 357 | $cssProperties = trim($chunks[1]);  | 
                                                        
| 358 | 358 | |
| 359 | 359 | // split multiple selectors  | 
                                                        
| 360 | -      $selectors = (array)explode(',', $selectors); | 
                                                        |
| 360 | +      $selectors = (array) explode(',', $selectors); | 
                                                        |
| 361 | 361 | |
| 362 | 362 | // loop selectors  | 
                                                        
| 363 | 363 |        foreach ($selectors as $selector) { | 
                                                        
@@ -426,7 +426,7 @@ discard block  | 
                                                    ||
| 426 | 426 | $css = $this->stripeMediaQueries($css);  | 
                                                        
| 427 | 427 | }  | 
                                                        
| 428 | 428 | |
| 429 | - return (string)$css;  | 
                                                        |
| 429 | + return (string) $css;  | 
                                                        |
| 430 | 430 | }  | 
                                                        
| 431 | 431 | |
| 432 | 432 | /**  | 
                                                        
@@ -441,7 +441,7 @@ discard block  | 
                                                    ||
| 441 | 441 | // remove comments previously to matching media queries  | 
                                                        
| 442 | 442 | $css = preg_replace(self::$styleCommentRegEx, '', $css);  | 
                                                        
| 443 | 443 | |
| 444 | - return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css);  | 
                                                        |
| 444 | + return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css);  | 
                                                        |
| 445 | 445 | }  | 
                                                        
| 446 | 446 | |
| 447 | 447 | /**  | 
                                                        
@@ -453,7 +453,7 @@ discard block  | 
                                                    ||
| 453 | 453 | */  | 
                                                        
| 454 | 454 | private function stripeCharsetInCss($css)  | 
                                                        
| 455 | 455 |    { | 
                                                        
| 456 | - return (string)preg_replace(self::$cssCharsetRegEx, '', $css);  | 
                                                        |
| 456 | + return (string) preg_replace(self::$cssCharsetRegEx, '', $css);  | 
                                                        |
| 457 | 457 | }  | 
                                                        
| 458 | 458 | |
| 459 | 459 | /**  | 
                                                        
@@ -474,7 +474,7 @@ discard block  | 
                                                    ||
| 474 | 474 | // loop properties  | 
                                                        
| 475 | 475 |      foreach ($properties as $property) { | 
                                                        
| 476 | 476 | // split into chunks  | 
                                                        
| 477 | -      $chunks = (array)explode(':', $property, 2); | 
                                                        |
| 477 | +      $chunks = (array) explode(':', $property, 2); | 
                                                        |
| 478 | 478 | |
| 479 | 479 | // validate  | 
                                                        
| 480 | 480 |        if (!isset($chunks[1])) { | 
                                                        
@@ -512,7 +512,7 @@ discard block  | 
                                                    ||
| 512 | 512 | */  | 
                                                        
| 513 | 513 | private function splitIntoProperties($styles)  | 
                                                        
| 514 | 514 |    { | 
                                                        
| 515 | -    $properties = (array)explode(';', $styles); | 
                                                        |
| 515 | +    $properties = (array) explode(';', $styles); | 
                                                        |
| 516 | 516 | $propertiesCount = count($properties);  | 
                                                        
| 517 | 517 | |
| 518 | 518 | /** @noinspection ForeachInvariantsInspection */  | 
                                                        
@@ -524,7 +524,7 @@ discard block  | 
                                                    ||
| 524 | 524 | &&  | 
                                                        
| 525 | 525 | strpos($properties[$i + 1], 'base64,') !== false  | 
                                                        
| 526 | 526 |        ) { | 
                                                        
| 527 | - $properties[$i] .= ';' . $properties[$i + 1];  | 
                                                        |
| 527 | + $properties[$i] .= ';'.$properties[$i + 1];  | 
                                                        |
| 528 | 528 | $properties[$i + 1] = '';  | 
                                                        
| 529 | 529 | ++$i;  | 
                                                        
| 530 | 530 | }  | 
                                                        
@@ -560,7 +560,7 @@ discard block  | 
                                                    ||
| 560 | 560 | $xmlHackUsed = false;  | 
                                                        
| 561 | 561 |      if (stripos('<?xml', $html) !== 0) { | 
                                                        
| 562 | 562 | $xmlHackUsed = true;  | 
                                                        
| 563 | - $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;  | 
                                                        |
| 563 | + $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;  | 
                                                        |
| 564 | 564 | }  | 
                                                        
| 565 | 565 | |
| 566 | 566 | // load HTML  | 
                                                        
@@ -719,7 +719,7 @@ discard block  | 
                                                    ||
| 719 | 719 |      if (null !== $stylesAttribute) { | 
                                                        
| 720 | 720 | // get value for the styles attribute  | 
                                                        
| 721 | 721 | /** @noinspection PhpUndefinedFieldInspection */  | 
                                                        
| 722 | - $definedStyles = (string)$stylesAttribute->value;  | 
                                                        |
| 722 | + $definedStyles = (string) $stylesAttribute->value;  | 
                                                        |
| 723 | 723 | |
| 724 | 724 | // split into properties  | 
                                                        
| 725 | 725 | $definedProperties = $this->splitIntoProperties($definedStyles);  | 
                                                        
@@ -736,7 +736,7 @@ discard block  | 
                                                    ||
| 736 | 736 | ||  | 
                                                        
| 737 | 737 | false === stripos($properties[$key], '!important')  | 
                                                        
| 738 | 738 | ||  | 
                                                        
| 739 | -          false !== stripos(implode('', (array)$value), '!important') | 
                                                        |
| 739 | +          false !== stripos(implode('', (array) $value), '!important') | 
                                                        |
| 740 | 740 |        ) { | 
                                                        
| 741 | 741 | $properties[$key] = $value;  | 
                                                        
| 742 | 742 | }  | 
                                                        
@@ -747,8 +747,8 @@ discard block  | 
                                                    ||
| 747 | 747 | |
| 748 | 748 | // build chunks  | 
                                                        
| 749 | 749 |      foreach ($properties as $key => $values) { | 
                                                        
| 750 | -      foreach ((array)$values as $value) { | 
                                                        |
| 751 | - $propertyChunks[] = $key . ': ' . $value . ';';  | 
                                                        |
| 750 | +      foreach ((array) $values as $value) { | 
                                                        |
| 751 | + $propertyChunks[] = $key.': '.$value.';';  | 
                                                        |
| 752 | 752 | }  | 
                                                        
| 753 | 753 | }  | 
                                                        
| 754 | 754 | |
@@ -777,7 +777,7 @@ discard block  | 
                                                    ||
| 777 | 777 | }  | 
                                                        
| 778 | 778 | |
| 779 | 779 | // split into chunks  | 
                                                        
| 780 | -      $chunks = (array)explode(':', trim($property), 2); | 
                                                        |
| 780 | +      $chunks = (array) explode(':', trim($property), 2); | 
                                                        |
| 781 | 781 | |
| 782 | 782 | // validate  | 
                                                        
| 783 | 783 |        if (!isset($chunks[1])) { | 
                                                        
@@ -843,7 +843,7 @@ discard block  | 
                                                    ||
| 843 | 843 | */  | 
                                                        
| 844 | 844 | public function setCleanup($on = true)  | 
                                                        
| 845 | 845 |    { | 
                                                        
| 846 | - $this->cleanup = (bool)$on;  | 
                                                        |
| 846 | + $this->cleanup = (bool) $on;  | 
                                                        |
| 847 | 847 | }  | 
                                                        
| 848 | 848 | |
| 849 | 849 | /**  | 
                                                        
@@ -855,7 +855,7 @@ discard block  | 
                                                    ||
| 855 | 855 | */  | 
                                                        
| 856 | 856 | public function setEncoding($encoding)  | 
                                                        
| 857 | 857 |    { | 
                                                        
| 858 | - $this->encoding = (string)$encoding;  | 
                                                        |
| 858 | + $this->encoding = (string) $encoding;  | 
                                                        |
| 859 | 859 | }  | 
                                                        
| 860 | 860 | |
| 861 | 861 | /**  | 
                                                        
@@ -866,7 +866,7 @@ discard block  | 
                                                    ||
| 866 | 866 | */  | 
                                                        
| 867 | 867 | public function setUseInlineStylesBlock($on = true)  | 
                                                        
| 868 | 868 |    { | 
                                                        
| 869 | - $this->useInlineStylesBlock = (bool)$on;  | 
                                                        |
| 869 | + $this->useInlineStylesBlock = (bool) $on;  | 
                                                        |
| 870 | 870 | }  | 
                                                        
| 871 | 871 | |
| 872 | 872 | /**  | 
                                                        
@@ -879,7 +879,7 @@ discard block  | 
                                                    ||
| 879 | 879 | */  | 
                                                        
| 880 | 880 | public function setLoadCSSFromHTML($on = true)  | 
                                                        
| 881 | 881 |    { | 
                                                        
| 882 | - $this->loadCSSFromHTML = (bool)$on;  | 
                                                        |
| 882 | + $this->loadCSSFromHTML = (bool) $on;  | 
                                                        |
| 883 | 883 | }  | 
                                                        
| 884 | 884 | |
| 885 | 885 | /**  | 
                                                        
@@ -890,7 +890,7 @@ discard block  | 
                                                    ||
| 890 | 890 | */  | 
                                                        
| 891 | 891 | public function setStripOriginalStyleTags($on = true)  | 
                                                        
| 892 | 892 |    { | 
                                                        
| 893 | - $this->stripOriginalStyleTags = (bool)$on;  | 
                                                        |
| 893 | + $this->stripOriginalStyleTags = (bool) $on;  | 
                                                        |
| 894 | 894 | }  | 
                                                        
| 895 | 895 | |
| 896 | 896 | /**  | 
                                                        
@@ -904,7 +904,7 @@ discard block  | 
                                                    ||
| 904 | 904 | */  | 
                                                        
| 905 | 905 | public function setExcludeMediaQueries($on = true)  | 
                                                        
| 906 | 906 |    { | 
                                                        
| 907 | - $this->excludeMediaQueries = (bool)$on;  | 
                                                        |
| 907 | + $this->excludeMediaQueries = (bool) $on;  | 
                                                        |
| 908 | 908 | }  | 
                                                        
| 909 | 909 | |
| 910 | 910 | /**  | 
                                                        
@@ -914,7 +914,7 @@ discard block  | 
                                                    ||
| 914 | 914 | */  | 
                                                        
| 915 | 915 | public function setExcludeCssCharset($on = true)  | 
                                                        
| 916 | 916 |    { | 
                                                        
| 917 | - $this->excludeCssCharset = (bool)$on;  | 
                                                        |
| 917 | + $this->excludeCssCharset = (bool) $on;  | 
                                                        |
| 918 | 918 | }  | 
                                                        
| 919 | 919 | |
| 920 | 920 | /**  | 
                                                        
@@ -924,7 +924,7 @@ discard block  | 
                                                    ||
| 924 | 924 | */  | 
                                                        
| 925 | 925 | public function setExcludeConditionalInlineStylesBlock($on = true)  | 
                                                        
| 926 | 926 |    { | 
                                                        
| 927 | - $this->excludeConditionalInlineStylesBlock = (bool)$on;  | 
                                                        |
| 927 | + $this->excludeConditionalInlineStylesBlock = (bool) $on;  | 
                                                        |
| 928 | 928 | }  | 
                                                        
| 929 | 929 | |
| 930 | 930 | /**  |