Passed
Push — master ( 00fb5c...511e7e )
by
unknown
01:47
created
src/Css/Style.php 1 patch
Spacing   +25 added lines, -25 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
      * https://www.w3.org/TR/css-values-3/#custom-idents
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
         if (!isset(self::$_defaults)) {
711 711
 
712 712
             // Shorthand
713
-            $d =& self::$_defaults;
713
+            $d = & self::$_defaults;
714 714
 
715 715
             // All CSS 2.1 properties, and their default values
716 716
             // Some properties are specified with their computed value for
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
 
1000 1000
             // Assume numeric values are already in points
1001 1001
             if (is_numeric($l)) {
1002
-                $ret += (float) $l;
1002
+                $ret += (float)$l;
1003 1003
                 continue;
1004 1004
             }
1005 1005
 
1006
-            $val = $this->single_length_in_pt((string) $l, $ref_size, $font_size);
1006
+            $val = $this->single_length_in_pt((string)$l, $ref_size, $font_size);
1007 1007
             $ret += $val ?? 0;
1008 1008
         }
1009 1009
 
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
             return null;
1044 1044
         }
1045 1045
 
1046
-        $v = (float) $matches[1];
1046
+        $v = (float)$matches[1];
1047 1047
         $unit = strtolower($matches[2]);
1048 1048
 
1049 1049
         if ($unit === "") {
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
             if (self::$_methods_cache[$method]) {
1599 1599
                 return $this->$method();
1600 1600
             } else {
1601
-                return implode(" ", array_map(function ($sub_prop) {
1601
+                return implode(" ", array_map(function($sub_prop) {
1602 1602
                     $val = $this->__get($sub_prop);
1603 1603
                     return \is_array($val) ? implode(" ", $val) : $val;
1604 1604
                 }, self::$_props_shorthand[$prop]));
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
         $font_size = $this->__get("font_size");
1828 1828
         $factor = $computed === "normal"
1829 1829
             ? self::$default_line_height
1830
-            : (float) $computed;
1830
+            : (float)$computed;
1831 1831
 
1832 1832
         return $factor * $font_size;
1833 1833
     }
@@ -2046,10 +2046,10 @@  discard block
 block discarded – undo
2046 2046
         // Use a fixed ref size here. We don't know the border-box width here
2047 2047
         // and font size might be 0. Since we are only interested in whether
2048 2048
         // there is any border radius at all, this should do
2049
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, 12);
2050
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, 12);
2051
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, 12);
2052
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, 12);
2049
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, 12);
2050
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, 12);
2051
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, 12);
2052
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, 12);
2053 2053
 
2054 2054
         $this->has_border_radius_cache = $tl + $tr + $br + $bl > 0;
2055 2055
         return $this->has_border_radius_cache;
@@ -2082,10 +2082,10 @@  discard block
 block discarded – undo
2082 2082
 
2083 2083
         // Resolve percentages relative to width, as long as we have no support
2084 2084
         // for per-axis radii
2085
-        $tl = (float) $this->length_in_pt($this->border_top_left_radius, $w);
2086
-        $tr = (float) $this->length_in_pt($this->border_top_right_radius, $w);
2087
-        $br = (float) $this->length_in_pt($this->border_bottom_right_radius, $w);
2088
-        $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, $w);
2085
+        $tl = (float)$this->length_in_pt($this->border_top_left_radius, $w);
2086
+        $tr = (float)$this->length_in_pt($this->border_top_right_radius, $w);
2087
+        $br = (float)$this->length_in_pt($this->border_bottom_right_radius, $w);
2088
+        $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, $w);
2089 2089
 
2090 2090
         if ($tl + $tr + $br + $bl > 0) {
2091 2091
             [$rx, $ry, $rw, $rh] = $render_box;
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
         // Convert escaped hex characters (e.g. \A => newline)
2234 2234
         return preg_replace_callback(
2235 2235
             "/\\\\([0-9a-fA-F]{1,6})/",
2236
-            function ($matches) { return Helpers::unichr(hexdec($matches[1])); },
2236
+            function($matches) { return Helpers::unichr(hexdec($matches[1])); },
2237 2237
             $string
2238 2238
         ) ?? "";
2239 2239
     }
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
     {
2304 2304
         $integer = self::CSS_INTEGER;
2305 2305
         return preg_match("/^$integer$/", $val)
2306
-            ? (int) $val
2306
+            ? (int)$val
2307 2307
             : null;
2308 2308
     }
2309 2309
 
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
     protected function _compute_font_family(string $val)
2770 2770
     {
2771 2771
         return array_map(
2772
-            function ($name) {
2772
+            function($name) {
2773 2773
                 return trim($name, " '\"");
2774 2774
             },
2775 2775
             preg_split("/\s*,\s*/", $val)
@@ -2880,7 +2880,7 @@  discard block
 block discarded – undo
2880 2880
             default:
2881 2881
                 $number = self::CSS_NUMBER;
2882 2882
                 $weight = preg_match("/^$number$/", $val)
2883
-                    ? (int) $val
2883
+                    ? (int)$val
2884 2884
                     : null;
2885 2885
                 return $weight !== null && $weight >= 1 && $weight <= 1000
2886 2886
                     ? $weight
@@ -3043,7 +3043,7 @@  discard block
 block discarded – undo
3043 3043
 
3044 3044
         // Compute number values to string and lengths to float (in pt)
3045 3045
         if (is_numeric($val)) {
3046
-            return (string) $val;
3046
+            return (string)$val;
3047 3047
         }
3048 3048
 
3049 3049
         $font_size = $this->__get("font_size");
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
                 return null;
3724 3724
             }
3725 3725
 
3726
-            $value = isset($match[2]) ? (int) $match[2] : $default;
3726
+            $value = isset($match[2]) ? (int)$match[2] : $default;
3727 3727
             $counters[$name] = $sumDuplicates
3728 3728
                 ? ($counters[$name] ?? 0) + $value
3729 3729
                 : $value;
@@ -4018,9 +4018,9 @@  discard block
 block discarded – undo
4018 4018
 
4019 4019
                             foreach ($values as $i => $value) {
4020 4020
                                 if (strpos($value, "rad")) {
4021
-                                    $values[$i] = rad2deg((float) $value);
4021
+                                    $values[$i] = rad2deg((float)$value);
4022 4022
                                 } else {
4023
-                                    $values[$i] = (float) $value;
4023
+                                    $values[$i] = (float)$value;
4024 4024
                                 }
4025 4025
                             }
4026 4026
 
@@ -4103,7 +4103,7 @@  discard block
 block discarded – undo
4103 4103
 
4104 4104
         $values = preg_split("/\s+/", $computed);
4105 4105
 
4106
-        $values = array_map(function ($value) {
4106
+        $values = array_map(function($value) {
4107 4107
             if (\in_array($value, ["top", "left"], true)) {
4108 4108
                 return 0;
4109 4109
             } elseif (\in_array($value, ["bottom", "right"], true)) {
@@ -4183,7 +4183,7 @@  discard block
 block discarded – undo
4183 4183
             return null;
4184 4184
         }
4185 4185
 
4186
-        $v = (float) $matches[1];
4186
+        $v = (float)$matches[1];
4187 4187
         $percent = $matches[2] === "%";
4188 4188
         $opacity = $percent ? ($v / 100) : $v;
4189 4189
 
Please login to merge, or discard this patch.