Passed
Push — master ( c9cf4b...907685 )
by Brian
11:29
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
 
190 190
     /**
191 191
      * @link https://www.w3.org/TR/css-values-4/#calc-syntax
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         "max" => true,
199 199
         "clamp" => true,
200 200
         // Stepped Value Functions
201
-        "round" => true,                          // Not fully supported
201
+        "round" => true, // Not fully supported
202 202
         "mod" => true,
203 203
         "rem" => true,
204 204
         // Trigonometric Functions
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
         if (!isset(self::$_defaults)) {
744 744
 
745 745
             // Shorthand
746
-            $d =& self::$_defaults;
746
+            $d = & self::$_defaults;
747 747
 
748 748
             // All CSS 2.1 properties, and their default values
749 749
             // Some properties are specified with their computed value for
@@ -1032,11 +1032,11 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
             // Assume numeric values are already in points
1034 1034
             if (is_numeric($l)) {
1035
-                $ret += (float) $l;
1035
+                $ret += (float)$l;
1036 1036
                 continue;
1037 1037
             }
1038 1038
 
1039
-            $val = $this->single_length_in_pt((string) $l, $ref_size, $font_size);
1039
+            $val = $this->single_length_in_pt((string)$l, $ref_size, $font_size);
1040 1040
             $ret += $val ?? 0;
1041 1041
         }
1042 1042
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
             return null;
1078 1078
         }
1079 1079
 
1080
-        $v = (float) $matches[1];
1080
+        $v = (float)$matches[1];
1081 1081
         $unit = strtolower($matches[2]);
1082 1082
 
1083 1083
         if ($unit === "") {
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
                         if ($argv[1] > 0) {
1275 1275
                             $stack[] = $argv[0] - floor($argv[0] / $argv[1]) * $argv[1];
1276 1276
                         } else {
1277
-                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1 ;
1277
+                            $stack[] = $argv[0] - ceil($argv[0] * -1 / $argv[1]) * $argv[1] * -1;
1278 1278
                         }
1279 1279
                         break;
1280 1280
                     case 'rem':
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
             if (self::$_methods_cache[$method]) {
1737 1737
                 return $this->$method();
1738 1738
             } else {
1739
-                return implode(" ", array_map(function ($sub_prop) {
1739
+                return implode(" ", array_map(function($sub_prop) {
1740 1740
                     $val = $this->__get($sub_prop);
1741 1741
                     return \is_array($val) ? implode(" ", $val) : $val;
1742 1742
                 }, self::$_props_shorthand[$prop]));
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
         $font_size = $this->__get("font_size");
1966 1966
         $factor = $computed === "normal"
1967 1967
             ? self::$default_line_height
1968
-            : (float) $computed;
1968
+            : (float)$computed;
1969 1969
 
1970 1970
         return $factor * $font_size;
1971 1971
     }
@@ -2184,10 +2184,10 @@  discard block
 block discarded – undo
2184 2184
         // Use a fixed ref size here. We don't know the border-box width here
2185 2185
         // and font size might be 0. Since we are only interested in whether
2186 2186
         // there is any border radius at all, this should do
2187
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, 12);
2188
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, 12);
2189
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, 12);
2190
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, 12);
2187
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, 12);
2188
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, 12);
2189
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, 12);
2190
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, 12);
2191 2191
 
2192 2192
         $this->has_border_radius_cache = $tl + $tr + $br + $bl > 0;
2193 2193
         return $this->has_border_radius_cache;
@@ -2220,10 +2220,10 @@  discard block
 block discarded – undo
2220 2220
 
2221 2221
         // Resolve percentages relative to width, as long as we have no support
2222 2222
         // for per-axis radii
2223
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, $w);
2224
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, $w);
2225
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, $w);
2226
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, $w);
2223
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, $w);
2224
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, $w);
2225
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, $w);
2226
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, $w);
2227 2227
 
2228 2228
         if ($tl + $tr + $br + $bl > 0) {
2229 2229
             [$rx, $ry, $rw, $rh] = $render_box;
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
         // Convert escaped hex characters (e.g. \A => newline)
2372 2372
         return preg_replace_callback(
2373 2373
             "/\\\\([0-9a-fA-F]{1,6})/",
2374
-            function ($matches) { return Helpers::unichr(hexdec($matches[1])); },
2374
+            function($matches) { return Helpers::unichr(hexdec($matches[1])); },
2375 2375
             $string
2376 2376
         ) ?? "";
2377 2377
     }
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
     {
2442 2442
         $integer = self::CSS_INTEGER;
2443 2443
         return preg_match("/^$integer$/", $val)
2444
-            ? (int) $val
2444
+            ? (int)$val
2445 2445
             : null;
2446 2446
     }
2447 2447
 
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
     {
2454 2454
         $number = self::CSS_NUMBER;
2455 2455
         return preg_match("/^$number$/", $val)
2456
-            ? (float) $val
2456
+            ? (float)$val
2457 2457
             : null;
2458 2458
     }
2459 2459
 
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
             return null;
2587 2587
         }
2588 2588
 
2589
-        $v = (float) $matches[1];
2589
+        $v = (float)$matches[1];
2590 2590
         $unit = strtolower($matches[2] ?? "");
2591 2591
 
2592 2592
         switch ($unit) {
@@ -2943,7 +2943,7 @@  discard block
 block discarded – undo
2943 2943
     protected function _compute_font_family(string $val)
2944 2944
     {
2945 2945
         return array_map(
2946
-            function ($name) {
2946
+            function($name) {
2947 2947
                 return trim($name, " '\"");
2948 2948
             },
2949 2949
             preg_split("/\s*,\s*/", $val)
@@ -3054,7 +3054,7 @@  discard block
 block discarded – undo
3054 3054
             default:
3055 3055
                 $number = self::CSS_NUMBER;
3056 3056
                 $weight = preg_match("/^$number$/", $val)
3057
-                    ? (int) $val
3057
+                    ? (int)$val
3058 3058
                     : null;
3059 3059
                 return $weight !== null && $weight >= 1 && $weight <= 1000
3060 3060
                     ? $weight
@@ -3217,7 +3217,7 @@  discard block
 block discarded – undo
3217 3217
 
3218 3218
         // Compute number values to string and lengths to float (in pt)
3219 3219
         if (is_numeric($val)) {
3220
-            return (string) $val;
3220
+            return (string)$val;
3221 3221
         }
3222 3222
 
3223 3223
         $font_size = $this->__get("font_size");
@@ -3898,7 +3898,7 @@  discard block
 block discarded – undo
3898 3898
                 return null;
3899 3899
             }
3900 3900
 
3901
-            $value = isset($match[2]) ? (int) $match[2] : $default;
3901
+            $value = isset($match[2]) ? (int)$match[2] : $default;
3902 3902
             $counters[$name] = $sumDuplicates
3903 3903
                 ? ($counters[$name] ?? 0) + $value
3904 3904
                 : $value;
@@ -4165,7 +4165,7 @@  discard block
 block discarded – undo
4165 4165
             $name = $matches[1];
4166 4166
             $arguments = trim($matches[2]);
4167 4167
             $values = $this->parse_property_value($arguments);
4168
-            $values = array_values(array_filter($values, function ($v) {
4168
+            $values = array_values(array_filter($values, function($v) {
4169 4169
                 return $v !== ",";
4170 4170
             }));
4171 4171
             $count = \count($values);
@@ -4384,7 +4384,7 @@  discard block
 block discarded – undo
4384 4384
             return null;
4385 4385
         }
4386 4386
 
4387
-        $v = (float) $matches[1];
4387
+        $v = (float)$matches[1];
4388 4388
         $percent = $matches[2] === "%";
4389 4389
         $opacity = $percent ? ($v / 100) : $v;
4390 4390
 
Please login to merge, or discard this patch.