Completed
Push — master ( 41a450...37af9a )
by Lars
14:34
created
src/CssToInlineStyles.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
   public function setHTML($html)
123 123
   {
124 124
     // strip style definitions, if we use css-class "cleanup" on a style-element
125
-    $this->html = (string)preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
125
+    $this->html = (string) preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
126 126
   }
127 127
 
128 128
   /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
    */
133 133
   public function setCSS($css)
134 134
   {
135
-    $this->css = (string)$css;
135
+    $this->css = (string) $css;
136 136
   }
137 137
 
138 138
   /**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
   public function convert($outputXHTML = false)
169 169
   {
170 170
     // redefine
171
-    $outputXHTML = (bool)$outputXHTML;
171
+    $outputXHTML = (bool) $outputXHTML;
172 172
 
173 173
     // validate
174 174
     if (!$this->html) {
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
     $cssRules = array();
264 264
 
265 265
     // init vars
266
-    $css = (string)$css;
266
+    $css = (string) $css;
267 267
 
268 268
     $css = $this->doCleanup($css);
269 269
 
270 270
     // rules are splitted by }
271
-    $rules = (array)explode('}', $css);
271
+    $rules = (array) explode('}', $css);
272 272
 
273 273
     // init var
274 274
     $i = 1;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
       $cssProperties = trim($chunks[1]);
291 291
 
292 292
       // split multiple selectors
293
-      $selectors = (array)explode(',', $selectors);
293
+      $selectors = (array) explode(',', $selectors);
294 294
 
295 295
       // loop selectors
296 296
       foreach ($selectors as $selector) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
       $css = $this->stripeMediaQueries($css);
355 355
     }
356 356
 
357
-    return (string)$css;
357
+    return (string) $css;
358 358
   }
359 359
 
360 360
   /**
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     // remove comments previously to matching media queries
370 370
     $css = preg_replace(self::$styleCommentRegEx, '', $css);
371 371
 
372
-    return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css);
372
+    return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css);
373 373
   }
374 374
 
375 375
   /**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     // loop properties
391 391
     foreach ($properties as $property) {
392 392
       // split into chunks
393
-      $chunks = (array)explode(':', $property, 2);
393
+      $chunks = (array) explode(':', $property, 2);
394 394
 
395 395
       // validate
396 396
       if (!isset($chunks[1])) {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
    */
429 429
   private function splitIntoProperties($styles)
430 430
   {
431
-    $properties = (array)explode(';', $styles);
431
+    $properties = (array) explode(';', $styles);
432 432
     $propertiesCount = count($properties);
433 433
 
434 434
     for ($i = 0; $i < $propertiesCount; $i++) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     // any styles defined before?
616 616
     if (null !== $stylesAttribute) {
617 617
       // get value for the styles attribute
618
-      $definedStyles = (string)$stylesAttribute->value;
618
+      $definedStyles = (string) $stylesAttribute->value;
619 619
 
620 620
       // split into properties
621 621
       $definedProperties = $this->splitIntoProperties($definedStyles);
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
           ||
633 633
           false === stripos($properties[$key], '!important')
634 634
           ||
635
-          false !== stripos(implode('', (array)$value), '!important')
635
+          false !== stripos(implode('', (array) $value), '!important')
636 636
       ) {
637 637
         $properties[$key] = $value;
638 638
       }
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
     // build chunks
645 645
     foreach ($properties as $key => $values) {
646
-      foreach ((array)$values as $value) {
646
+      foreach ((array) $values as $value) {
647 647
         $propertyChunks[] = $key . ': ' . $value . ';';
648 648
       }
649 649
     }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
       }
674 674
 
675 675
       // split into chunks
676
-      $chunks = (array)explode(':', trim($property), 2);
676
+      $chunks = (array) explode(':', trim($property), 2);
677 677
 
678 678
       // validate
679 679
       if (!isset($chunks[1])) {
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
    */
740 740
   public function setCleanup($on = true)
741 741
   {
742
-    $this->cleanup = (bool)$on;
742
+    $this->cleanup = (bool) $on;
743 743
   }
744 744
 
745 745
   /**
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
    */
752 752
   public function setEncoding($encoding)
753 753
   {
754
-    $this->encoding = (string)$encoding;
754
+    $this->encoding = (string) $encoding;
755 755
   }
756 756
 
757 757
   /**
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
    */
763 763
   public function setUseInlineStylesBlock($on = true)
764 764
   {
765
-    $this->useInlineStylesBlock = (bool)$on;
765
+    $this->useInlineStylesBlock = (bool) $on;
766 766
   }
767 767
 
768 768
   /**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
    */
774 774
   public function setStripOriginalStyleTags($on = true)
775 775
   {
776
-    $this->stripOriginalStyleTags = (bool)$on;
776
+    $this->stripOriginalStyleTags = (bool) $on;
777 777
   }
778 778
 
779 779
   /**
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
    */
788 788
   public function setExcludeMediaQueries($on = true)
789 789
   {
790
-    $this->excludeMediaQueries = (bool)$on;
790
+    $this->excludeMediaQueries = (bool) $on;
791 791
   }
792 792
 
793 793
   /**
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
    */
798 798
   public function setExcludeConditionalInlineStylesBlock($on = true)
799 799
   {
800
-    $this->excludeConditionalInlineStylesBlock = (bool)$on;
800
+    $this->excludeConditionalInlineStylesBlock = (bool) $on;
801 801
   }
802 802
 
803 803
 }
Please login to merge, or discard this patch.