Completed
Pull Request — master (#192)
by
unknown
01:50
created
src/Css/Property/Processor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
             // if the new property begins with base64 it is part of the current property
27 27
             if (isset($properties[$i + 1]) && strpos(trim($properties[$i + 1]), 'base64,') === 0) {
28
-                $properties[$i] .= ';' . trim($properties[$i + 1]);
28
+                $properties[$i] .= ';'.trim($properties[$i + 1]);
29 29
                 $keysToRemove[] = $i + 1;
30 30
             }
31 31
         }
Please login to merge, or discard this patch.
example/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
6 6
 
7 7
 // create instance
8 8
 $cssToInlineStyles = new CssToInlineStyles();
9 9
 
10
-$html = file_get_contents(__DIR__ . '/examples/sumo/index.htm');
11
-$css = file_get_contents(__DIR__ . '/examples/sumo/style.css');
10
+$html = file_get_contents(__DIR__.'/examples/sumo/index.htm');
11
+$css = file_get_contents(__DIR__.'/examples/sumo/style.css');
12 12
 
13 13
 // output
14 14
 echo $cssToInlineStyles->convert(
Please login to merge, or discard this patch.
src/CssToInlineStyles.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $rules        = $processor->getRules($styleTagCss);
46 46
 
47 47
         // process extra css included as string argument to this function
48
-        if ( $css !== null ) {
48
+        if ($css !== null) {
49 49
             $mediaQueries = $processor->getMediaQueries($css, $mediaQueries);
50 50
             $rules        = $processor->getRules($css, $rules);
51 51
         }
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
      * @return \DOMDocument
212 212
      */
213 213
     protected function appendMediaQueries(\DOMDocument $document, array $mediaQueries) {
214
-        if ( ! sizeof($mediaQueries) ) return $document;
214
+        if (!sizeof($mediaQueries)) return $document;
215 215
         $style = $document->createElement('style', implode($mediaQueries));
216
-        if ( $style ) {
216
+        if ($style) {
217 217
             $head = $document->getElementsByTagName('head')->item(0);
218 218
             // Partials aren't supported (missing head tag). But lets play nice.
219
-            if ( $head !== null ) {
219
+            if ($head !== null) {
220 220
                 $head->appendChild($style);
221 221
             } else {
222 222
                 $docNode = $document->documentElement;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -211,7 +211,9 @@
 block discarded – undo
211 211
      * @return \DOMDocument
212 212
      */
213 213
     protected function appendMediaQueries(\DOMDocument $document, array $mediaQueries) {
214
-        if ( ! sizeof($mediaQueries) ) return $document;
214
+        if ( ! sizeof($mediaQueries) ) {
215
+            return $document;
216
+        }
215 217
         $style = $document->createElement('style', implode($mediaQueries));
216 218
         if ( $style ) {
217 219
             $head = $document->getElementsByTagName('head')->item(0);
Please login to merge, or discard this patch.
src/Css/Processor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function getMediaQueries(string $css, array $existingMediaQueries = array()) {
35 35
         $matches = [];
36
-        if ( preg_match_all( '/@media [^{]*+{([^{}]++|{[^{}]*+})*+}/', $css, $matches ) ) {
36
+        if (preg_match_all('/@media [^{]*+{([^{}]++|{[^{}]*+})*+}/', $css, $matches)) {
37 37
             return array_merge($existingMediaQueries, $matches[0]);
38 38
         }
39 39
         return $existingMediaQueries;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         if (!empty($matches[1])) {
57 57
             foreach ($matches[1] as $match) {
58
-                $css .= trim($match) . "\n";
58
+                $css .= trim($match)."\n";
59 59
             }
60 60
         }
61 61
 
Please login to merge, or discard this patch.