Passed
Push — master ( a373c4...e1d262 )
by Brian
09:34
created
src/Css/Style.php 1 patch
Spacing   +28 added lines, -28 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
@@ -1062,11 +1062,11 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
             // Assume numeric values are already in points
1064 1064
             if (is_numeric($l)) {
1065
-                $ret += (float) $l;
1065
+                $ret += (float)$l;
1066 1066
                 continue;
1067 1067
             }
1068 1068
 
1069
-            $val = $this->single_length_in_pt((string) $l, $ref_size, $font_size);
1069
+            $val = $this->single_length_in_pt((string)$l, $ref_size, $font_size);
1070 1070
             $ret += $val ?? 0;
1071 1071
         }
1072 1072
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
             return null;
1108 1108
         }
1109 1109
 
1110
-        $v = (float) $matches[1];
1110
+        $v = (float)$matches[1];
1111 1111
         $unit = strtolower($matches[2]);
1112 1112
 
1113 1113
         if ($unit === "") {
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
                         if ($argv[1] > 0) {
1305 1305
                             $stack[] = $argv[0] - floor($argv[0] / $argv[1]) * $argv[1];
1306 1306
                         } else {
1307
-                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1 ;
1307
+                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1;
1308 1308
                         }
1309 1309
                         break;
1310 1310
                     case 'rem':
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 
1700 1700
             // Always set the specified value for properties that use CSS variables
1701 1701
             // so that an invalid initial value does not prevent re-computation later.
1702
-            if (\is_string($val) && \preg_match("/". self::CSS_VAR . "/", $val)) {
1702
+            if (\is_string($val) && \preg_match("/" . self::CSS_VAR . "/", $val)) {
1703 1703
                 $this->_props[$prop] = $val;
1704 1704
             }
1705 1705
 
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
             if (self::$_methods_cache[$method]) {
1883 1883
                 return $this->$method();
1884 1884
             } else {
1885
-                return implode(" ", array_map(function ($sub_prop) {
1885
+                return implode(" ", array_map(function($sub_prop) {
1886 1886
                     $val = $this->__get($sub_prop);
1887 1887
                     return \is_array($val) ? implode(" ", $val) : $val;
1888 1888
                 }, self::$_props_shorthand[$prop]));
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
         $font_size = $this->__get("font_size");
2129 2129
         $factor = $computed === "normal"
2130 2130
             ? self::$default_line_height
2131
-            : (float) $computed;
2131
+            : (float)$computed;
2132 2132
 
2133 2133
         return $factor * $font_size;
2134 2134
     }
@@ -2347,10 +2347,10 @@  discard block
 block discarded – undo
2347 2347
         // Use a fixed ref size here. We don't know the border-box width here
2348 2348
         // and font size might be 0. Since we are only interested in whether
2349 2349
         // there is any border radius at all, this should do
2350
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, 12);
2351
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, 12);
2352
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, 12);
2353
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, 12);
2350
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, 12);
2351
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, 12);
2352
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, 12);
2353
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, 12);
2354 2354
 
2355 2355
         $this->has_border_radius_cache = $tl + $tr + $br + $bl > 0;
2356 2356
         return $this->has_border_radius_cache;
@@ -2383,10 +2383,10 @@  discard block
 block discarded – undo
2383 2383
 
2384 2384
         // Resolve percentages relative to width, as long as we have no support
2385 2385
         // for per-axis radii
2386
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, $w);
2387
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, $w);
2388
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, $w);
2389
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, $w);
2386
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, $w);
2387
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, $w);
2388
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, $w);
2389
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, $w);
2390 2390
 
2391 2391
         if ($tl + $tr + $br + $bl > 0) {
2392 2392
             [$rx, $ry, $rw, $rh] = $render_box;
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
         // Convert escaped hex characters (e.g. \A => newline)
2535 2535
         return preg_replace_callback(
2536 2536
             "/\\\\([0-9a-fA-F]{1,6})/",
2537
-            function ($matches) { return Helpers::unichr(hexdec($matches[1])); },
2537
+            function($matches) { return Helpers::unichr(hexdec($matches[1])); },
2538 2538
             $string
2539 2539
         ) ?? "";
2540 2540
     }
@@ -2604,7 +2604,7 @@  discard block
 block discarded – undo
2604 2604
     {
2605 2605
         $integer = self::CSS_INTEGER;
2606 2606
         return preg_match("/^$integer$/", $val)
2607
-            ? (int) $val
2607
+            ? (int)$val
2608 2608
             : null;
2609 2609
     }
2610 2610
 
@@ -2616,7 +2616,7 @@  discard block
 block discarded – undo
2616 2616
     {
2617 2617
         $number = self::CSS_NUMBER;
2618 2618
         return preg_match("/^$number$/", $val)
2619
-            ? (float) $val
2619
+            ? (float)$val
2620 2620
             : null;
2621 2621
     }
2622 2622
 
@@ -2749,7 +2749,7 @@  discard block
 block discarded – undo
2749 2749
             return null;
2750 2750
         }
2751 2751
 
2752
-        $v = (float) $matches[1];
2752
+        $v = (float)$matches[1];
2753 2753
         $unit = strtolower($matches[2] ?? "");
2754 2754
 
2755 2755
         switch ($unit) {
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
     protected function _compute_font_family(string $val)
3107 3107
     {
3108 3108
         return array_map(
3109
-            function ($name) {
3109
+            function($name) {
3110 3110
                 return trim($name, " '\"");
3111 3111
             },
3112 3112
             preg_split("/\s*,\s*/", $val)
@@ -3217,7 +3217,7 @@  discard block
 block discarded – undo
3217 3217
             default:
3218 3218
                 $number = self::CSS_NUMBER;
3219 3219
                 $weight = preg_match("/^$number$/", $val)
3220
-                    ? (int) $val
3220
+                    ? (int)$val
3221 3221
                     : null;
3222 3222
                 return $weight !== null && $weight >= 1 && $weight <= 1000
3223 3223
                     ? $weight
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
         // Compute number values to string and lengths to float (in pt)
3382 3382
         if (is_numeric($val)) {
3383
-            return (string) $val;
3383
+            return (string)$val;
3384 3384
         }
3385 3385
 
3386 3386
         $font_size = $this->__get("font_size");
@@ -4061,7 +4061,7 @@  discard block
 block discarded – undo
4061 4061
                 return null;
4062 4062
             }
4063 4063
 
4064
-            $value = isset($match[2]) ? (int) $match[2] : $default;
4064
+            $value = isset($match[2]) ? (int)$match[2] : $default;
4065 4065
             $counters[$name] = $sumDuplicates
4066 4066
                 ? ($counters[$name] ?? 0) + $value
4067 4067
                 : $value;
@@ -4328,7 +4328,7 @@  discard block
 block discarded – undo
4328 4328
             $name = $matches[1];
4329 4329
             $arguments = trim($matches[2]);
4330 4330
             $values = $this->parse_property_value($arguments);
4331
-            $values = array_values(array_filter($values, function ($v) {
4331
+            $values = array_values(array_filter($values, function($v) {
4332 4332
                 return $v !== ",";
4333 4333
             }));
4334 4334
             $count = \count($values);
@@ -4547,7 +4547,7 @@  discard block
 block discarded – undo
4547 4547
             return null;
4548 4548
         }
4549 4549
 
4550
-        $v = (float) $matches[1];
4550
+        $v = (float)$matches[1];
4551 4551
         $percent = $matches[2] === "%";
4552 4552
         $opacity = $percent ? ($v / 100) : $v;
4553 4553
 
Please login to merge, or discard this patch.