Completed
Push — master ( 765a44...73a9cf )
by Lars
02:54
created
src/CssToInlineStyles.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -794,16 +794,16 @@
 block discarded – undo
794 794
   }
795 795
 
796 796
   /**
797
-       * Set use of inline link block
798
-       * If this is enabled the class will use the links reference in the HTML.
799
-       *
800
-       * @return void
801
-       * @param  bool [optional] $on Should we process link styles?
802
-       */
797
+   * Set use of inline link block
798
+   * If this is enabled the class will use the links reference in the HTML.
799
+   *
800
+   * @return void
801
+   * @param  bool [optional] $on Should we process link styles?
802
+   */
803 803
     public function setLoadCSSFromHTML($on = true)
804
-     {
805
-         $this->loadCSSFromHTML = (bool) $on;
806
-     }
804
+      {
805
+          $this->loadCSSFromHTML = (bool) $on;
806
+      }
807 807
 
808 808
   /**
809 809
    * Set strip original style tags
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
   public function setHTML($html)
130 130
   {
131 131
     // strip style definitions, if we use css-class "cleanup" on a style-element
132
-    $this->html = (string)preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
132
+    $this->html = (string) preg_replace('/<style[^>]+class="cleanup"[^>]*>.*<\/style>/Usi', ' ', $html);
133 133
   }
134 134
 
135 135
   /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
    */
140 140
   public function setCSS($css)
141 141
   {
142
-    $this->css = (string)$css;
142
+    $this->css = (string) $css;
143 143
   }
144 144
 
145 145
   /**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
   public function convert($outputXHTML = false, $libXMLOptions = 0, $path = false)
181 181
   {
182 182
     // redefine
183
-    $outputXHTML = (bool)$outputXHTML;
183
+    $outputXHTML = (bool) $outputXHTML;
184 184
 
185 185
     // validate
186 186
     if (!$this->html) {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     // check if there is some link css reference
197 197
     if ($this->loadCSSFromHTML) {
198 198
       foreach ($document->getElementsByTagName('link') as $node) {
199
-        $file = ($path ? $path : __DIR__) . '/' .  $node->getAttribute('href');
199
+        $file = ($path ? $path : __DIR__) . '/' . $node->getAttribute('href');
200 200
 
201 201
         if (file_exists($file)) {
202 202
           $css .= file_get_contents($file);
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
     $cssRules = array();
290 290
 
291 291
     // init vars
292
-    $css = (string)$css;
292
+    $css = (string) $css;
293 293
 
294 294
     $css = $this->doCleanup($css);
295 295
 
296 296
     // rules are splitted by }
297
-    $rules = (array)explode('}', $css);
297
+    $rules = (array) explode('}', $css);
298 298
 
299 299
     // init var
300 300
     $i = 1;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
       $cssProperties = trim($chunks[1]);
317 317
 
318 318
       // split multiple selectors
319
-      $selectors = (array)explode(',', $selectors);
319
+      $selectors = (array) explode(',', $selectors);
320 320
 
321 321
       // loop selectors
322 322
       foreach ($selectors as $selector) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
       $css = $this->stripeMediaQueries($css);
381 381
     }
382 382
 
383
-    return (string)$css;
383
+    return (string) $css;
384 384
   }
385 385
 
386 386
   /**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     // remove comments previously to matching media queries
396 396
     $css = preg_replace(self::$styleCommentRegEx, '', $css);
397 397
 
398
-    return (string)preg_replace(self::$cssMediaQueriesRegEx, '', $css);
398
+    return (string) preg_replace(self::$cssMediaQueriesRegEx, '', $css);
399 399
   }
400 400
 
401 401
   /**
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     // loop properties
417 417
     foreach ($properties as $property) {
418 418
       // split into chunks
419
-      $chunks = (array)explode(':', $property, 2);
419
+      $chunks = (array) explode(':', $property, 2);
420 420
 
421 421
       // validate
422 422
       if (!isset($chunks[1])) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
    */
455 455
   private function splitIntoProperties($styles)
456 456
   {
457
-    $properties = (array)explode(';', $styles);
457
+    $properties = (array) explode(';', $styles);
458 458
     $propertiesCount = count($properties);
459 459
 
460 460
     for ($i = 0; $i < $propertiesCount; $i++) {
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
     // any styles defined before?
644 644
     if (null !== $stylesAttribute) {
645 645
       // get value for the styles attribute
646
-      $definedStyles = (string)$stylesAttribute->value;
646
+      $definedStyles = (string) $stylesAttribute->value;
647 647
 
648 648
       // split into properties
649 649
       $definedProperties = $this->splitIntoProperties($definedStyles);
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
           ||
661 661
           false === stripos($properties[$key], '!important')
662 662
           ||
663
-          false !== stripos(implode('', (array)$value), '!important')
663
+          false !== stripos(implode('', (array) $value), '!important')
664 664
       ) {
665 665
         $properties[$key] = $value;
666 666
       }
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
     // build chunks
673 673
     foreach ($properties as $key => $values) {
674
-      foreach ((array)$values as $value) {
674
+      foreach ((array) $values as $value) {
675 675
         $propertyChunks[] = $key . ': ' . $value . ';';
676 676
       }
677 677
     }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
       }
702 702
 
703 703
       // split into chunks
704
-      $chunks = (array)explode(':', trim($property), 2);
704
+      $chunks = (array) explode(':', trim($property), 2);
705 705
 
706 706
       // validate
707 707
       if (!isset($chunks[1])) {
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
    */
768 768
   public function setCleanup($on = true)
769 769
   {
770
-    $this->cleanup = (bool)$on;
770
+    $this->cleanup = (bool) $on;
771 771
   }
772 772
 
773 773
   /**
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
    */
780 780
   public function setEncoding($encoding)
781 781
   {
782
-    $this->encoding = (string)$encoding;
782
+    $this->encoding = (string) $encoding;
783 783
   }
784 784
 
785 785
   /**
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
    */
791 791
   public function setUseInlineStylesBlock($on = true)
792 792
   {
793
-    $this->useInlineStylesBlock = (bool)$on;
793
+    $this->useInlineStylesBlock = (bool) $on;
794 794
   }
795 795
 
796 796
   /**
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
    */
814 814
   public function setStripOriginalStyleTags($on = true)
815 815
   {
816
-    $this->stripOriginalStyleTags = (bool)$on;
816
+    $this->stripOriginalStyleTags = (bool) $on;
817 817
   }
818 818
 
819 819
   /**
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
    */
828 828
   public function setExcludeMediaQueries($on = true)
829 829
   {
830
-    $this->excludeMediaQueries = (bool)$on;
830
+    $this->excludeMediaQueries = (bool) $on;
831 831
   }
832 832
 
833 833
   /**
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
    */
838 838
   public function setExcludeConditionalInlineStylesBlock($on = true)
839 839
   {
840
-    $this->excludeConditionalInlineStylesBlock = (bool)$on;
840
+    $this->excludeConditionalInlineStylesBlock = (bool) $on;
841 841
   }
842 842
 
843 843
 }
Please login to merge, or discard this patch.