@@ -185,7 +185,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | { |
2316 | 2316 | $number = self::CSS_NUMBER; |
2317 | 2317 | return preg_match("/^$number$/", $val) |
2318 | - ? (float) $val |
|
2318 | + ? (float)$val |
|
2319 | 2319 | : null; |
2320 | 2320 | } |
2321 | 2321 | |
@@ -2448,7 +2448,7 @@ discard block |
||
2448 | 2448 | return null; |
2449 | 2449 | } |
2450 | 2450 | |
2451 | - $v = (float) $matches[1]; |
|
2451 | + $v = (float)$matches[1]; |
|
2452 | 2452 | $unit = strtolower($matches[2] ?? ""); |
2453 | 2453 | |
2454 | 2454 | switch ($unit) { |
@@ -2805,7 +2805,7 @@ discard block |
||
2805 | 2805 | protected function _compute_font_family(string $val) |
2806 | 2806 | { |
2807 | 2807 | return array_map( |
2808 | - function ($name) { |
|
2808 | + function($name) { |
|
2809 | 2809 | return trim($name, " '\""); |
2810 | 2810 | }, |
2811 | 2811 | preg_split("/\s*,\s*/", $val) |
@@ -2916,7 +2916,7 @@ discard block |
||
2916 | 2916 | default: |
2917 | 2917 | $number = self::CSS_NUMBER; |
2918 | 2918 | $weight = preg_match("/^$number$/", $val) |
2919 | - ? (int) $val |
|
2919 | + ? (int)$val |
|
2920 | 2920 | : null; |
2921 | 2921 | return $weight !== null && $weight >= 1 && $weight <= 1000 |
2922 | 2922 | ? $weight |
@@ -3079,7 +3079,7 @@ discard block |
||
3079 | 3079 | |
3080 | 3080 | // Compute number values to string and lengths to float (in pt) |
3081 | 3081 | if (is_numeric($val)) { |
3082 | - return (string) $val; |
|
3082 | + return (string)$val; |
|
3083 | 3083 | } |
3084 | 3084 | |
3085 | 3085 | $font_size = $this->__get("font_size"); |
@@ -3760,7 +3760,7 @@ discard block |
||
3760 | 3760 | return null; |
3761 | 3761 | } |
3762 | 3762 | |
3763 | - $value = isset($match[2]) ? (int) $match[2] : $default; |
|
3763 | + $value = isset($match[2]) ? (int)$match[2] : $default; |
|
3764 | 3764 | $counters[$name] = $sumDuplicates |
3765 | 3765 | ? ($counters[$name] ?? 0) + $value |
3766 | 3766 | : $value; |
@@ -4027,7 +4027,7 @@ discard block |
||
4027 | 4027 | $name = $matches[1]; |
4028 | 4028 | $arguments = trim($matches[2]); |
4029 | 4029 | $values = $this->parse_property_value($arguments); |
4030 | - $values = array_values(array_filter($values, function ($v) { |
|
4030 | + $values = array_values(array_filter($values, function($v) { |
|
4031 | 4031 | return $v !== ","; |
4032 | 4032 | })); |
4033 | 4033 | $count = \count($values); |
@@ -4246,7 +4246,7 @@ discard block |
||
4246 | 4246 | return null; |
4247 | 4247 | } |
4248 | 4248 | |
4249 | - $v = (float) $matches[1]; |
|
4249 | + $v = (float)$matches[1]; |
|
4250 | 4250 | $percent = $matches[2] === "%"; |
4251 | 4251 | $opacity = $percent ? ($v / 100) : $v; |
4252 | 4252 |
@@ -80,8 +80,8 @@ |
||
80 | 80 | |
81 | 81 | [$x, $y] = $frame->get_padding_box(); |
82 | 82 | [$originX, $originY] = $style->transform_origin; |
83 | - $w = (float) $style->length_in_pt($style->width); |
|
84 | - $h = (float) $style->length_in_pt($style->height); |
|
83 | + $w = (float)$style->length_in_pt($style->width); |
|
84 | + $h = (float)$style->length_in_pt($style->height); |
|
85 | 85 | |
86 | 86 | foreach ($transformList as $transform) { |
87 | 87 | [$function, $values] = $transform; |