Completed
Push — master ( fe503f...f8da28 )
by Lars
02:14
created
Category
src/CssToInlineStyles.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
   public function setHTML($html)
124 124
   {
125 125
     // strip style definitions, if we use css-class "cleanup" on a style-element
126
-    $this->html = (string)preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
126
+    $this->html = (string) preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
127 127
   }
128 128
 
129 129
   /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
    */
134 134
   public function setCSS($css)
135 135
   {
136
-    $this->css = (string)$css;
136
+    $this->css = (string) $css;
137 137
   }
138 138
 
139 139
   /**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
   public function convert($outputXHTML = false)
170 170
   {
171 171
     // redefine
172
-    $outputXHTML = (bool)$outputXHTML;
172
+    $outputXHTML = (bool) $outputXHTML;
173 173
 
174 174
     // validate
175 175
     if (!$this->html) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     $cssRules = array();
265 265
 
266 266
     // init vars
267
-    $css = (string)$css;
267
+    $css = (string) $css;
268 268
 
269 269
     // remove newlines & replace double quotes by single quotes
270 270
     $css = str_replace(
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     }
286 286
 
287 287
     // rules are splitted by }
288
-    $rules = (array)explode('}', $css);
288
+    $rules = (array) explode('}', $css);
289 289
 
290 290
     // init var
291 291
     $i = 1;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
       $cssProperties = UTF8::trim($chunks[1]);
308 308
 
309 309
       // split multiple selectors
310
-      $selectors = (array)explode(',', $selectors);
310
+      $selectors = (array) explode(',', $selectors);
311 311
 
312 312
       // loop selectors
313 313
       foreach ($selectors as $selector) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     // remove comments previously to matching media queries
359 359
     $css = preg_replace(self::$styleCommentRegEx, '', $css);
360 360
 
361
-    return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css);
361
+    return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css);
362 362
   }
363 363
 
364 364
   /**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     // loop properties
380 380
     foreach ($properties as $property) {
381 381
       // split into chunks
382
-      $chunks = (array)explode(':', $property, 2);
382
+      $chunks = (array) explode(':', $property, 2);
383 383
 
384 384
       // validate
385 385
       if (!isset($chunks[1])) {
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
    */
418 418
   private function splitIntoProperties($styles)
419 419
   {
420
-    $properties = (array)explode(';', $styles);
420
+    $properties = (array) explode(';', $styles);
421 421
     $propertiesCount = count($properties);
422 422
 
423 423
     for ($i = 0; $i < $propertiesCount; $i++) {
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
       }
606 606
 
607 607
       // split into chunks
608
-      $chunks = (array)explode(':', UTF8::trim($property), 2);
608
+      $chunks = (array) explode(':', UTF8::trim($property), 2);
609 609
 
610 610
       // validate
611 611
       if (!isset($chunks[1])) {
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     // any styles defined before?
637 637
     if (null !== $stylesAttribute) {
638 638
       // get value for the styles attribute
639
-      $definedStyles = (string)$stylesAttribute->value;
639
+      $definedStyles = (string) $stylesAttribute->value;
640 640
 
641 641
       // split into properties
642 642
       $definedProperties = $this->splitIntoProperties($definedStyles);
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 
665 665
     // build chunks
666 666
     foreach ($properties as $key => $values) {
667
-      foreach ((array)$values as $value) {
667
+      foreach ((array) $values as $value) {
668 668
         $propertyChunks[] = $key . ': ' . $value . ';';
669 669
       }
670 670
     }
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
    */
725 725
   public function setCleanup($on = true)
726 726
   {
727
-    $this->cleanup = (bool)$on;
727
+    $this->cleanup = (bool) $on;
728 728
   }
729 729
 
730 730
   /**
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
    */
737 737
   public function setEncoding($encoding)
738 738
   {
739
-    $this->encoding = (string)$encoding;
739
+    $this->encoding = (string) $encoding;
740 740
   }
741 741
 
742 742
   /**
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
    */
748 748
   public function setUseInlineStylesBlock($on = true)
749 749
   {
750
-    $this->useInlineStylesBlock = (bool)$on;
750
+    $this->useInlineStylesBlock = (bool) $on;
751 751
   }
752 752
 
753 753
   /**
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
    */
759 759
   public function setStripOriginalStyleTags($on = true)
760 760
   {
761
-    $this->stripOriginalStyleTags = (bool)$on;
761
+    $this->stripOriginalStyleTags = (bool) $on;
762 762
   }
763 763
 
764 764
   /**
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
    */
773 773
   public function setExcludeMediaQueries($on = true)
774 774
   {
775
-    $this->excludeMediaQueries = (bool)$on;
775
+    $this->excludeMediaQueries = (bool) $on;
776 776
   }
777 777
 
778 778
   /**
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
    */
783 783
   public function setExcludeConditionalInlineStylesBlock($on = true)
784 784
   {
785
-    $this->excludeConditionalInlineStylesBlock = (bool)$on;
785
+    $this->excludeConditionalInlineStylesBlock = (bool) $on;
786 786
   }
787 787
 
788 788
 }
Please login to merge, or discard this patch.