Completed
Push — master ( f8da28...d77e91 )
by Lars
02:16
created
src/CssToInlineStyles.php 1 patch
Spacing   +19 added lines, -19 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) {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
       $css = $this->stripeMediaQueries($css);
277 277
     }
278 278
 
279
-    return (string)$css;
279
+    return (string) $css;
280 280
   }
281 281
 
282 282
   /**
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
     $cssRules = array();
293 293
 
294 294
     // init vars
295
-    $css = (string)$css;
295
+    $css = (string) $css;
296 296
 
297 297
     $css = $this->doCleanup($css);
298 298
 
299 299
     // rules are splitted by }
300
-    $rules = (array)explode('}', $css);
300
+    $rules = (array) explode('}', $css);
301 301
 
302 302
     // init var
303 303
     $i = 1;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
       $cssProperties = trim($chunks[1]);
320 320
 
321 321
       // split multiple selectors
322
-      $selectors = (array)explode(',', $selectors);
322
+      $selectors = (array) explode(',', $selectors);
323 323
 
324 324
       // loop selectors
325 325
       foreach ($selectors as $selector) {
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     // remove comments previously to matching media queries
371 371
     $css = preg_replace(self::$styleCommentRegEx, '', $css);
372 372
 
373
-    return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css);
373
+    return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css);
374 374
   }
375 375
 
376 376
   /**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     // loop properties
392 392
     foreach ($properties as $property) {
393 393
       // split into chunks
394
-      $chunks = (array)explode(':', $property, 2);
394
+      $chunks = (array) explode(':', $property, 2);
395 395
 
396 396
       // validate
397 397
       if (!isset($chunks[1])) {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
    */
430 430
   private function splitIntoProperties($styles)
431 431
   {
432
-    $properties = (array)explode(';', $styles);
432
+    $properties = (array) explode(';', $styles);
433 433
     $propertiesCount = count($properties);
434 434
 
435 435
     for ($i = 0; $i < $propertiesCount; $i++) {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
       }
618 618
 
619 619
       // split into chunks
620
-      $chunks = (array)explode(':', trim($property), 2);
620
+      $chunks = (array) explode(':', trim($property), 2);
621 621
 
622 622
       // validate
623 623
       if (!isset($chunks[1])) {
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
     // any styles defined before?
649 649
     if (null !== $stylesAttribute) {
650 650
       // get value for the styles attribute
651
-      $definedStyles = (string)$stylesAttribute->value;
651
+      $definedStyles = (string) $stylesAttribute->value;
652 652
 
653 653
       // split into properties
654 654
       $definedProperties = $this->splitIntoProperties($definedStyles);
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 
677 677
     // build chunks
678 678
     foreach ($properties as $key => $values) {
679
-      foreach ((array)$values as $value) {
679
+      foreach ((array) $values as $value) {
680 680
         $propertyChunks[] = $key . ': ' . $value . ';';
681 681
       }
682 682
     }
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
    */
737 737
   public function setCleanup($on = true)
738 738
   {
739
-    $this->cleanup = (bool)$on;
739
+    $this->cleanup = (bool) $on;
740 740
   }
741 741
 
742 742
   /**
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
    */
749 749
   public function setEncoding($encoding)
750 750
   {
751
-    $this->encoding = (string)$encoding;
751
+    $this->encoding = (string) $encoding;
752 752
   }
753 753
 
754 754
   /**
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
    */
760 760
   public function setUseInlineStylesBlock($on = true)
761 761
   {
762
-    $this->useInlineStylesBlock = (bool)$on;
762
+    $this->useInlineStylesBlock = (bool) $on;
763 763
   }
764 764
 
765 765
   /**
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
    */
771 771
   public function setStripOriginalStyleTags($on = true)
772 772
   {
773
-    $this->stripOriginalStyleTags = (bool)$on;
773
+    $this->stripOriginalStyleTags = (bool) $on;
774 774
   }
775 775
 
776 776
   /**
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
    */
785 785
   public function setExcludeMediaQueries($on = true)
786 786
   {
787
-    $this->excludeMediaQueries = (bool)$on;
787
+    $this->excludeMediaQueries = (bool) $on;
788 788
   }
789 789
 
790 790
   /**
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
    */
795 795
   public function setExcludeConditionalInlineStylesBlock($on = true)
796 796
   {
797
-    $this->excludeConditionalInlineStylesBlock = (bool)$on;
797
+    $this->excludeConditionalInlineStylesBlock = (bool) $on;
798 798
   }
799 799
 
800 800
 }
Please login to merge, or discard this patch.