@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\CssToInlineStyles; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\CssToInlineStyles; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\CssToInlineStyles; |
6 | 6 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function setHTML(string $html) |
179 | 179 | { |
180 | 180 | // strip style definitions, if we use css-class "cleanup" on a style-element |
181 | - $this->html = (string)\preg_replace(self::$styleTagWithCleanupClassRegEx, ' ', $html); |
|
181 | + $this->html = (string) \preg_replace(self::$styleTagWithCleanupClassRegEx, ' ', $html); |
|
182 | 182 | |
183 | 183 | return $this; |
184 | 184 | } |
@@ -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>', "\n" . '<style type="text/css">' . "\n" . $this->css_media_queries . "\n" . '</style>' . "\n" . '</head>', $html); |
|
307 | + $html = \str_ireplace('</head>', "\n".'<style type="text/css">'."\n".$this->css_media_queries."\n".'</style>'."\n".'</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,7 +352,7 @@ discard block |
||
352 | 352 | $cssRules = []; |
353 | 353 | |
354 | 354 | // init vars |
355 | - $css = (string)$css; |
|
355 | + $css = (string) $css; |
|
356 | 356 | |
357 | 357 | $css = $this->doCleanup($css); |
358 | 358 | |
@@ -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): string |
493 | 493 | { |
494 | - return (string)\preg_replace(self::$cssCharsetRegEx, '', $css); |
|
494 | + return (string) \preg_replace(self::$cssCharsetRegEx, '', $css); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -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 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | if ($originalStyle) { |
648 | 648 | /** @noinspection PhpUndefinedFieldInspection */ |
649 | - $originalStyle = (string)$originalStyle->value; |
|
649 | + $originalStyle = (string) $originalStyle->value; |
|
650 | 650 | } else { |
651 | 651 | $originalStyle = ''; |
652 | 652 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | if (null !== $stylesAttribute) { |
703 | 703 | // get value for the styles attribute |
704 | 704 | /** @noinspection PhpUndefinedFieldInspection */ |
705 | - $definedStyles = (string)$stylesAttribute->value; |
|
705 | + $definedStyles = (string) $stylesAttribute->value; |
|
706 | 706 | |
707 | 707 | // split into properties |
708 | 708 | $definedProperties = $this->splitIntoProperties($definedStyles); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | || |
720 | 720 | false === \stripos($properties[$key], '!important') |
721 | 721 | || |
722 | - false !== \stripos(\implode('', (array)$value), '!important') |
|
722 | + false !== \stripos(\implode('', (array) $value), '!important') |
|
723 | 723 | ) { |
724 | 724 | unset($properties[$key]); |
725 | 725 | $properties[$key] = $value; |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | |
732 | 732 | // build chunks |
733 | 733 | foreach ($properties as $key => $values) { |
734 | - foreach ((array)$values as $value) { |
|
735 | - $propertyChunks[] = $key . ': ' . $value . ';'; |
|
734 | + foreach ((array) $values as $value) { |
|
735 | + $propertyChunks[] = $key.': '.$value.';'; |
|
736 | 736 | } |
737 | 737 | } |
738 | 738 |