@@ -1688,12 +1688,16 @@ discard block |
||
1688 | 1688 | $DEBUGCSS = $this->_dompdf->getOptions()->getDebugCss(); |
1689 | 1689 | |
1690 | 1690 | $sections = explode("}", $str); |
1691 | - if ($DEBUGCSS) print '[_parse_sections'; |
|
1691 | + if ($DEBUGCSS) { |
|
1692 | + print '[_parse_sections'; |
|
1693 | + } |
|
1692 | 1694 | foreach ($sections as $sect) { |
1693 | 1695 | $i = mb_strpos($sect, "{"); |
1694 | 1696 | if ($i === false) { continue; } |
1695 | 1697 | |
1696 | - if ($DEBUGCSS) print '[section'; |
|
1698 | + if ($DEBUGCSS) { |
|
1699 | + print '[section'; |
|
1700 | + } |
|
1697 | 1701 | |
1698 | 1702 | $selector_str = preg_replace($patterns, $replacements, mb_substr($sect, 0, $i)); |
1699 | 1703 | $selectors = preg_split("/,(?![^\(]*\))/", $selector_str, 0, PREG_SPLIT_NO_EMPTY); |
@@ -1704,10 +1708,14 @@ discard block |
||
1704 | 1708 | $selector = trim($selector); |
1705 | 1709 | |
1706 | 1710 | if ($selector === "") { |
1707 | - if ($DEBUGCSS) print '#empty#'; |
|
1711 | + if ($DEBUGCSS) { |
|
1712 | + print '#empty#'; |
|
1713 | + } |
|
1708 | 1714 | continue; |
1709 | 1715 | } |
1710 | - if ($DEBUGCSS) print '#' . $selector . '#'; |
|
1716 | + if ($DEBUGCSS) { |
|
1717 | + print '#' . $selector . '#'; |
|
1718 | + } |
|
1711 | 1719 | //if ($DEBUGCSS) { if (strpos($selector,'p') !== false) print '!!!p!!!#'; } |
1712 | 1720 | |
1713 | 1721 | //FIXME: tag the selector with a hash of the media query to separate it from non-conditional styles (?), xpath comments are probably not what we want to do here |
@@ -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 | } |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | { |
2302 | 2302 | $integer = self::CSS_INTEGER; |
2303 | 2303 | return preg_match("/^$integer$/", $val) |
2304 | - ? (int) $val |
|
2304 | + ? (int)$val |
|
2305 | 2305 | : null; |
2306 | 2306 | } |
2307 | 2307 | |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | protected function _compute_font_family(string $val) |
2768 | 2768 | { |
2769 | 2769 | return array_map( |
2770 | - function ($name) { |
|
2770 | + function($name) { |
|
2771 | 2771 | return trim($name, " '\""); |
2772 | 2772 | }, |
2773 | 2773 | preg_split("/\s*,\s*/", $val) |
@@ -2878,7 +2878,7 @@ discard block |
||
2878 | 2878 | default: |
2879 | 2879 | $number = self::CSS_NUMBER; |
2880 | 2880 | $weight = preg_match("/^$number$/", $val) |
2881 | - ? (int) $val |
|
2881 | + ? (int)$val |
|
2882 | 2882 | : null; |
2883 | 2883 | return $weight !== null && $weight >= 1 && $weight <= 1000 |
2884 | 2884 | ? $weight |
@@ -3041,7 +3041,7 @@ discard block |
||
3041 | 3041 | |
3042 | 3042 | // Compute number values to string and lengths to float (in pt) |
3043 | 3043 | if (is_numeric($val)) { |
3044 | - return (string) $val; |
|
3044 | + return (string)$val; |
|
3045 | 3045 | } |
3046 | 3046 | |
3047 | 3047 | $font_size = $this->__get("font_size"); |
@@ -3721,7 +3721,7 @@ discard block |
||
3721 | 3721 | return null; |
3722 | 3722 | } |
3723 | 3723 | |
3724 | - $value = isset($match[2]) ? (int) $match[2] : $default; |
|
3724 | + $value = isset($match[2]) ? (int)$match[2] : $default; |
|
3725 | 3725 | $counters[$name] = $sumDuplicates |
3726 | 3726 | ? ($counters[$name] ?? 0) + $value |
3727 | 3727 | : $value; |
@@ -4016,9 +4016,9 @@ discard block |
||
4016 | 4016 | |
4017 | 4017 | foreach ($values as $i => $value) { |
4018 | 4018 | if (strpos($value, "rad")) { |
4019 | - $values[$i] = rad2deg((float) $value); |
|
4019 | + $values[$i] = rad2deg((float)$value); |
|
4020 | 4020 | } else { |
4021 | - $values[$i] = (float) $value; |
|
4021 | + $values[$i] = (float)$value; |
|
4022 | 4022 | } |
4023 | 4023 | } |
4024 | 4024 | |
@@ -4101,7 +4101,7 @@ discard block |
||
4101 | 4101 | |
4102 | 4102 | $values = preg_split("/\s+/", $computed); |
4103 | 4103 | |
4104 | - $values = array_map(function ($value) { |
|
4104 | + $values = array_map(function($value) { |
|
4105 | 4105 | if (\in_array($value, ["top", "left"], true)) { |
4106 | 4106 | return 0; |
4107 | 4107 | } elseif (\in_array($value, ["bottom", "right"], true)) { |
@@ -4181,7 +4181,7 @@ discard block |
||
4181 | 4181 | return null; |
4182 | 4182 | } |
4183 | 4183 | |
4184 | - $v = (float) $matches[1]; |
|
4184 | + $v = (float)$matches[1]; |
|
4185 | 4185 | $percent = $matches[2] === "%"; |
4186 | 4186 | $opacity = $percent ? ($v / 100) : $v; |
4187 | 4187 |