Test Setup Failed
Push — master ( b1f007...e678e2 )
by Arjan
05:09
created
src/Laravel/Command/ViewCompilerCommand.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -146,6 +146,9 @@
 block discarded – undo
146 146
         $this->table(['Minification strategy', 'Size (KB)', 'Saved (KB)', 'Size (%)'], $rows);
147 147
     }
148 148
 
149
+    /**
150
+     * @param integer $new
151
+     */
149 152
     private function calculateImprovementPercentage($new, $old)
150 153
     {
151 154
         return ($new - $old) / $old * 100;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function setupCompiler()
54 54
     {
55
-        Blade::extend(function ($value, $compiler) {
55
+        Blade::extend(function($value, $compiler) {
56 56
             BladePlaceholder::setBladeTags($this->getBladeTags($compiler));
57 57
 
58 58
             $context = new MinifyContext(new PlaceholderContainer());
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
         $totalBytesSavedPercentage = 0;
124 124
 
125 125
         $lastReferencePoint = null;
126
-        $rows = $referencePoints->map(function (ReferencePoint $referencePoint) use (&$lastReferencePoint, &$totalBytesSavedPercentage) {
126
+        $rows = $referencePoints->map(function(ReferencePoint $referencePoint) use (&$lastReferencePoint, &$totalBytesSavedPercentage) {
127 127
             $bytesSaved = '';
128 128
             $bytesSavedPercentage = '';
129 129
             if ($lastReferencePoint != null) {
130 130
                 $bytesSaved = $lastReferencePoint->getKiloBytes() - $referencePoint->getKiloBytes();
131 131
                 $totalBytesSavedPercentage += $bytesSavedPercentage = $this->calculateImprovementPercentage($referencePoint->getKiloBytes(), $lastReferencePoint->getKiloBytes());
132
-                $bytesSavedPercentage = round(abs($bytesSavedPercentage),1).'%';
132
+                $bytesSavedPercentage = round(abs($bytesSavedPercentage), 1).'%';
133 133
             }
134 134
             $lastReferencePoint = $referencePoint;
135 135
 
136
-            return [$referencePoint->getName(), round($referencePoint->getKiloBytes(),1), round($bytesSaved,1), $bytesSavedPercentage];
136
+            return [$referencePoint->getName(), round($referencePoint->getKiloBytes(), 1), round($bytesSaved, 1), $bytesSavedPercentage];
137 137
         });
138 138
 
139 139
         $rows[] = [
140 140
             'Total',
141
-            round($referencePoints->last()->getKiloBytes(),1),
142
-            abs(round($referencePoints->last()->getKiloBytes() - $referencePoints->first()->getKiloBytes(),1)),
143
-            abs(round($totalBytesSavedPercentage,1)).'%'
141
+            round($referencePoints->last()->getKiloBytes(), 1),
142
+            abs(round($referencePoints->last()->getKiloBytes() - $referencePoints->first()->getKiloBytes(), 1)),
143
+            abs(round($totalBytesSavedPercentage, 1)).'%'
144 144
         ];
145 145
 
146 146
         $this->table(['Minification strategy', 'Size (KB)', 'Saved (KB)', 'Size (%)'], $rows);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     protected function getOptions()
160 160
     {
161 161
         $options = Collection::make(Options::options())
162
-            ->map(function (Option $option) {
162
+            ->map(function(Option $option) {
163 163
                 return [
164 164
                     $option->getName(),
165 165
                     null,
Please login to merge, or discard this patch.
src/Measurements/MeasurementInterface.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * Get all the steps which are measured.
19 19
      *
20
-     * @return array
20
+     * @return ReferencePoint[]
21 21
      */
22 22
     public function getReferencePoints();
23 23
 }
Please login to merge, or discard this patch.
src/Measurements/ReferencePoint.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     }
38 38
 
39 39
     /**
40
-     * @return float
40
+     * @return integer
41 41
      */
42 42
     public function getKiloBytes()
43 43
     {
Please login to merge, or discard this patch.
src/MinifyContext.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -78,6 +78,9 @@
 block discarded – undo
78 78
         $this->measurement->createReferencePoint($this->calculateInputLength($input), $keyName);
79 79
     }
80 80
 
81
+    /**
82
+     * @param string $input
83
+     */
81 84
     private function calculateInputLength($input)
82 85
     {
83 86
         return mb_strlen($input, '8bit') + $this->placeholderContainer->getOriginalSize() - $this->placeholderContainer->getPlaceholderSize();
Please login to merge, or discard this patch.
src/Placeholders/WhitespacePlaceholder.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace ArjanSchouten\HtmlMinifier\Placeholders;
4 4
 
5 5
 use ArjanSchouten\HtmlMinifier\PlaceholderContainer;
6
-use ArjanSchouten\HtmlMinifier\Repositories\HtmlInlineElementsRepository;
7 6
 
8 7
 class WhitespacePlaceholder implements PlaceholderInterface
9 8
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                 \s+                             # Match minimal 1 whitespace between the elements
64 64
                 <('.$elementsRegex.')           # Match the start of the next inline element
65 65
             /xi',
66
-            function ($match) use ($placeholderContainer) {
66
+            function($match) use ($placeholderContainer) {
67 67
                 // Where going to respect one space between the inline elements.
68 68
                 $placeholder = $placeholderContainer->addPlaceholder(' ');
69 69
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 )
94 94
                 <('.$elementsRegex.')       # Match starting tag
95 95
             /xis',
96
-            function ($match) use ($placeholderContainer) {
96
+            function($match) use ($placeholderContainer) {
97 97
                 return $this->replaceWhitespacesInInlineElements($match[1], $placeholderContainer).'<'.$match[3];
98 98
             }, $contents);
99 99
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     private function replaceWhitespacesInInlineElements($element, PlaceholderContainer $placeholderContainer)
110 110
     {
111
-        return preg_replace_callback('/>\s/', function ($match) use ($placeholderContainer) {
111
+        return preg_replace_callback('/>\s/', function($match) use ($placeholderContainer) {
112 112
             return '>'.$placeholderContainer->addPlaceholder(' ');
113 113
         }, $element);
114 114
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             ((?:(?!<\/\2>).)+)
135 135
             (<\/\2>)/xis';
136 136
 
137
-        return preg_replace_callback($pattern, function ($match) use ($placeholderContainer) {
137
+        return preg_replace_callback($pattern, function($match) use ($placeholderContainer) {
138 138
             return $match[1].$placeholderContainer->addPlaceholder($match[3]).$match[4];
139 139
         }, $contents);
140 140
     }
Please login to merge, or discard this patch.
src/Laravel/HtmlMinifierServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function registerBladeMinifier()
36 36
     {
37
-        $this->app->singleton('blade.compiler.min', function () {
37
+        $this->app->singleton('blade.compiler.min', function() {
38 38
             return new Minify();
39 39
         });
40 40
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function registerPhpMinifier()
48 48
     {
49
-        $this->app->singleton('php.min', function () {
49
+        $this->app->singleton('php.min', function() {
50 50
             return new Minify();
51 51
         });
52 52
     }
Please login to merge, or discard this patch.
src/Minifiers/Html/AttributeQuoteMinifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
                             )*                              # special part of "unrolling the loop"
49 49
                     )       # use a the "unrolling the loop" technique to be able to skip escaped quotes like ="\""
50 50
                 \1?         # match the same quote symbol as matched before
51
-            /x', function ($match) {
51
+            /x', function($match) {
52 52
             return $this->minifyAttribute($match);
53 53
         }, $context->getContents()));
54 54
     }
Please login to merge, or discard this patch.
src/Minifiers/Html/BooleanAttributeMinifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
                 ([\'"])?                    # optional to use a quote
32 32
                 (\1|true|false|([\s>"\']))    # match the boolean attribute name again or true|false
33 33
                 \2?                         # match the quote again
34
-            /xi', function ($match) {
34
+            /xi', function($match) {
35 35
                 if (isset($match[4])) {
36 36
                     return ' '.$match[1];
37 37
                 }
Please login to merge, or discard this patch.
src/Minifiers/Html/CommentMinifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                 <!          # search for the start of a comment
24 24
                     [^>]*   # search for everything without a ">"
25 25
                 >           # match the end of the comment
26
-            /xs', function ($match) {
26
+            /xs', function($match) {
27 27
             if (Str::contains(strtolower($match[0]), 'doctype')) {
28 28
                 return $match[0];
29 29
             }
Please login to merge, or discard this patch.