Passed
Push — master ( 9c6228...a30da0 )
by Brian
01:22
created
src/Css/Style.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     protected const CSS_NUMBER = "[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?";
186 186
     protected const CSS_STRING = "" .
187 187
         '"(?>(?:\\\\["]|[^"])*)(?<!\\\\)"|' . // String ""
188
-        "'(?>(?:\\\\[']|[^'])*)(?<!\\\\)'";   // String ''
188
+        "'(?>(?:\\\\[']|[^'])*)(?<!\\\\)'"; // String ''
189 189
     protected const CSS_VAR = "var\((([^()]|(?R))*)\)";
190 190
 
191 191
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         "max" => true,
200 200
         "clamp" => true,
201 201
         // Stepped Value Functions
202
-        "round" => true,                          // Not fully supported
202
+        "round" => true, // Not fully supported
203 203
         "mod" => true,
204 204
         "rem" => true,
205 205
         // Trigonometric Functions
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
         if (!isset(self::$_defaults)) {
769 769
 
770 770
             // Shorthand
771
-            $d =& self::$_defaults;
771
+            $d = & self::$_defaults;
772 772
 
773 773
             // All CSS 2.1 properties, and their default values
774 774
             // Some properties are specified with their computed value for
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
             // Assume numeric values are already in points
1059 1059
             if (is_numeric($l)) {
1060
-                $ret += (float) $l;
1060
+                $ret += (float)$l;
1061 1061
                 continue;
1062 1062
             }
1063 1063
 
1064
-            $val = $this->single_length_in_pt((string) $l, $ref_size, $font_size);
1064
+            $val = $this->single_length_in_pt((string)$l, $ref_size, $font_size);
1065 1065
             $ret += $val ?? 0;
1066 1066
         }
1067 1067
 
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
             return null;
1103 1103
         }
1104 1104
 
1105
-        $v = (float) $matches[1];
1105
+        $v = (float)$matches[1];
1106 1106
         $unit = strtolower($matches[2]);
1107 1107
 
1108 1108
         if ($unit === "") {
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
                         if ($argv[1] > 0) {
1300 1300
                             $stack[] = $argv[0] - floor($argv[0] / $argv[1]) * $argv[1];
1301 1301
                         } else {
1302
-                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1 ;
1302
+                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1;
1303 1303
                         }
1304 1304
                         break;
1305 1305
                     case 'rem':
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
             if (self::$_methods_cache[$method]) {
1878 1878
                 return $this->$method();
1879 1879
             } else {
1880
-                return implode(" ", array_map(function ($sub_prop) {
1880
+                return implode(" ", array_map(function($sub_prop) {
1881 1881
                     $val = $this->__get($sub_prop);
1882 1882
                     return \is_array($val) ? implode(" ", $val) : $val;
1883 1883
                 }, self::$_props_shorthand[$prop]));
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
         $font_size = $this->__get("font_size");
2124 2124
         $factor = $computed === "normal"
2125 2125
             ? self::$default_line_height
2126
-            : (float) $computed;
2126
+            : (float)$computed;
2127 2127
 
2128 2128
         return $factor * $font_size;
2129 2129
     }
@@ -2342,10 +2342,10 @@  discard block
 block discarded – undo
2342 2342
         // Use a fixed ref size here. We don't know the border-box width here
2343 2343
         // and font size might be 0. Since we are only interested in whether
2344 2344
         // there is any border radius at all, this should do
2345
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, 12);
2346
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, 12);
2347
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, 12);
2348
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, 12);
2345
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, 12);
2346
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, 12);
2347
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, 12);
2348
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, 12);
2349 2349
 
2350 2350
         $this->has_border_radius_cache = $tl + $tr + $br + $bl > 0;
2351 2351
         return $this->has_border_radius_cache;
@@ -2378,10 +2378,10 @@  discard block
 block discarded – undo
2378 2378
 
2379 2379
         // Resolve percentages relative to width, as long as we have no support
2380 2380
         // for per-axis radii
2381
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, $w);
2382
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, $w);
2383
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, $w);
2384
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, $w);
2381
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, $w);
2382
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, $w);
2383
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, $w);
2384
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, $w);
2385 2385
 
2386 2386
         if ($tl + $tr + $br + $bl > 0) {
2387 2387
             [$rx, $ry, $rw, $rh] = $render_box;
@@ -2529,7 +2529,7 @@  discard block
 block discarded – undo
2529 2529
         // Convert escaped hex characters (e.g. \A => newline)
2530 2530
         return preg_replace_callback(
2531 2531
             "/\\\\([0-9a-fA-F]{1,6})/",
2532
-            function ($matches) { return Helpers::unichr(hexdec($matches[1])); },
2532
+            function($matches) { return Helpers::unichr(hexdec($matches[1])); },
2533 2533
             $string
2534 2534
         ) ?? "";
2535 2535
     }
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
     {
2600 2600
         $integer = self::CSS_INTEGER;
2601 2601
         return preg_match("/^$integer$/", $val)
2602
-            ? (int) $val
2602
+            ? (int)$val
2603 2603
             : null;
2604 2604
     }
2605 2605
 
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
     {
2612 2612
         $number = self::CSS_NUMBER;
2613 2613
         return preg_match("/^$number$/", $val)
2614
-            ? (float) $val
2614
+            ? (float)$val
2615 2615
             : null;
2616 2616
     }
2617 2617
 
@@ -2744,7 +2744,7 @@  discard block
 block discarded – undo
2744 2744
             return null;
2745 2745
         }
2746 2746
 
2747
-        $v = (float) $matches[1];
2747
+        $v = (float)$matches[1];
2748 2748
         $unit = strtolower($matches[2] ?? "");
2749 2749
 
2750 2750
         switch ($unit) {
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
     protected function _compute_font_family(string $val)
3102 3102
     {
3103 3103
         return array_map(
3104
-            function ($name) {
3104
+            function($name) {
3105 3105
                 return trim($name, " '\"");
3106 3106
             },
3107 3107
             preg_split("/\s*,\s*/", $val)
@@ -3212,7 +3212,7 @@  discard block
 block discarded – undo
3212 3212
             default:
3213 3213
                 $number = self::CSS_NUMBER;
3214 3214
                 $weight = preg_match("/^$number$/", $val)
3215
-                    ? (int) $val
3215
+                    ? (int)$val
3216 3216
                     : null;
3217 3217
                 return $weight !== null && $weight >= 1 && $weight <= 1000
3218 3218
                     ? $weight
@@ -3375,7 +3375,7 @@  discard block
 block discarded – undo
3375 3375
 
3376 3376
         // Compute number values to string and lengths to float (in pt)
3377 3377
         if (is_numeric($val)) {
3378
-            return (string) $val;
3378
+            return (string)$val;
3379 3379
         }
3380 3380
 
3381 3381
         $font_size = $this->__get("font_size");
@@ -4056,7 +4056,7 @@  discard block
 block discarded – undo
4056 4056
                 return null;
4057 4057
             }
4058 4058
 
4059
-            $value = isset($match[2]) ? (int) $match[2] : $default;
4059
+            $value = isset($match[2]) ? (int)$match[2] : $default;
4060 4060
             $counters[$name] = $sumDuplicates
4061 4061
                 ? ($counters[$name] ?? 0) + $value
4062 4062
                 : $value;
@@ -4323,7 +4323,7 @@  discard block
 block discarded – undo
4323 4323
             $name = $matches[1];
4324 4324
             $arguments = trim($matches[2]);
4325 4325
             $values = $this->parse_property_value($arguments);
4326
-            $values = array_values(array_filter($values, function ($v) {
4326
+            $values = array_values(array_filter($values, function($v) {
4327 4327
                 return $v !== ",";
4328 4328
             }));
4329 4329
             $count = \count($values);
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
             return null;
4543 4543
         }
4544 4544
 
4545
-        $v = (float) $matches[1];
4545
+        $v = (float)$matches[1];
4546 4546
         $percent = $matches[2] === "%";
4547 4547
         $opacity = $percent ? ($v / 100) : $v;
4548 4548
 
Please login to merge, or discard this patch.