@@ -820,55 +820,33 @@ |
||
820 | 820 | // Legacy support for unitless values, not covered by spec. Might |
821 | 821 | // want to restrict this to unitless `0` in the future |
822 | 822 | $value = (float) $l; |
823 | - } |
|
824 | - |
|
825 | - elseif (($i = mb_stripos($l, "%")) !== false) { |
|
823 | + } elseif (($i = mb_stripos($l, "%")) !== false) { |
|
826 | 824 | $value = (float)mb_substr($l, 0, $i) / 100 * $ref_size; |
827 | - } |
|
828 | - |
|
829 | - elseif (($i = mb_stripos($l, "px")) !== false) { |
|
825 | + } elseif (($i = mb_stripos($l, "px")) !== false) { |
|
830 | 826 | $dpi = $this->_stylesheet->get_dompdf()->getOptions()->getDpi(); |
831 | 827 | $value = ((float)mb_substr($l, 0, $i) * 72) / $dpi; |
832 | - } |
|
833 | - |
|
834 | - elseif (($i = mb_stripos($l, "pt")) !== false) { |
|
828 | + } elseif (($i = mb_stripos($l, "pt")) !== false) { |
|
835 | 829 | $value = (float)mb_substr($l, 0, $i); |
836 | - } |
|
837 | - |
|
838 | - elseif (($i = mb_stripos($l, "rem")) !== false) { |
|
830 | + } elseif (($i = mb_stripos($l, "rem")) !== false) { |
|
839 | 831 | $root_style = $this->_stylesheet->get_dompdf()->getTree()->get_root()->get_style(); |
840 | 832 | $root_font_size = $root_style === null || $root_style === $this |
841 | 833 | ? $font_size |
842 | 834 | : $root_style->__get("font_size"); |
843 | 835 | $value = (float)mb_substr($l, 0, $i) * $root_font_size; |
844 | - } |
|
845 | - |
|
846 | - elseif (($i = mb_stripos($l, "em")) !== false) { |
|
836 | + } elseif (($i = mb_stripos($l, "em")) !== false) { |
|
847 | 837 | $value = (float)mb_substr($l, 0, $i) * $font_size; |
848 | - } |
|
849 | - |
|
850 | - elseif (($i = mb_stripos($l, "cm")) !== false) { |
|
838 | + } elseif (($i = mb_stripos($l, "cm")) !== false) { |
|
851 | 839 | $value = (float)mb_substr($l, 0, $i) * 72 / 2.54; |
852 | - } |
|
853 | - |
|
854 | - elseif (($i = mb_stripos($l, "mm")) !== false) { |
|
840 | + } elseif (($i = mb_stripos($l, "mm")) !== false) { |
|
855 | 841 | $value = (float)mb_substr($l, 0, $i) * 72 / 25.4; |
856 | - } |
|
857 | - |
|
858 | - elseif (($i = mb_stripos($l, "ex")) !== false) { |
|
842 | + } elseif (($i = mb_stripos($l, "ex")) !== false) { |
|
859 | 843 | // FIXME: em:ex ratio? |
860 | 844 | $value = (float)mb_substr($l, 0, $i) * $font_size / 2; |
861 | - } |
|
862 | - |
|
863 | - elseif (($i = mb_stripos($l, "in")) !== false) { |
|
845 | + } elseif (($i = mb_stripos($l, "in")) !== false) { |
|
864 | 846 | $value = (float)mb_substr($l, 0, $i) * 72; |
865 | - } |
|
866 | - |
|
867 | - elseif (($i = mb_stripos($l, "pc")) !== false) { |
|
847 | + } elseif (($i = mb_stripos($l, "pc")) !== false) { |
|
868 | 848 | $value = (float)mb_substr($l, 0, $i) * 12; |
869 | - } |
|
870 | - |
|
871 | - else { |
|
849 | + } else { |
|
872 | 850 | // Invalid or unsupported declaration |
873 | 851 | $value = null; |
874 | 852 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | if (!isset(self::$_defaults)) { |
450 | 450 | |
451 | 451 | // Shorthand |
452 | - $d =& self::$_defaults; |
|
452 | + $d = & self::$_defaults; |
|
453 | 453 | |
454 | 454 | // All CSS 2.1 properties, and their default values |
455 | 455 | $d["azimuth"] = "center"; |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | |
779 | 779 | // Assume numeric values are already in points |
780 | 780 | if (is_numeric($l)) { |
781 | - $ret += (float) $l; |
|
781 | + $ret += (float)$l; |
|
782 | 782 | continue; |
783 | 783 | } |
784 | 784 | |
785 | - $val = $this->single_length_in_pt((string) $l, $ref_size, $font_size); |
|
785 | + $val = $this->single_length_in_pt((string)$l, $ref_size, $font_size); |
|
786 | 786 | |
787 | 787 | // FIXME: Using the ref size as fallback here currently ensures that |
788 | 788 | // invalid widths or heights are treated as the corresponding |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | if (is_numeric($l)) { |
820 | 820 | // Legacy support for unitless values, not covered by spec. Might |
821 | 821 | // want to restrict this to unitless `0` in the future |
822 | - $value = (float) $l; |
|
822 | + $value = (float)$l; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | elseif (($i = mb_stripos($l, "%")) !== false) { |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | if (self::$_methods_cache[$method]) { |
1220 | 1220 | return $this->$method(); |
1221 | 1221 | } else { |
1222 | - return implode(" ", array_map(function ($sub_prop) { |
|
1222 | + return implode(" ", array_map(function($sub_prop) { |
|
1223 | 1223 | $val = $this->__get($sub_prop); |
1224 | 1224 | return is_array($val) ? implode(" ", $val) : $val; |
1225 | 1225 | }, self::$_props_shorthand[$prop])); |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $font_size = $this->__get("font_size"); |
1465 | 1465 | $factor = $computed === "normal" |
1466 | 1466 | ? self::$default_line_height |
1467 | - : (float) $computed; |
|
1467 | + : (float)$computed; |
|
1468 | 1468 | |
1469 | 1469 | return $factor * $font_size; |
1470 | 1470 | } |
@@ -1727,10 +1727,10 @@ discard block |
||
1727 | 1727 | // Use a fixed ref size here. We don't know the border-box width here |
1728 | 1728 | // and font size might be 0. Since we are only interested in whether |
1729 | 1729 | // there is any border radius at all, this should do |
1730 | - $tl = (float) $this->length_in_pt($this->border_top_left_radius, 10); |
|
1731 | - $tr = (float) $this->length_in_pt($this->border_top_right_radius, 10); |
|
1732 | - $br = (float) $this->length_in_pt($this->border_bottom_right_radius, 10); |
|
1733 | - $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, 10); |
|
1730 | + $tl = (float)$this->length_in_pt($this->border_top_left_radius, 10); |
|
1731 | + $tr = (float)$this->length_in_pt($this->border_top_right_radius, 10); |
|
1732 | + $br = (float)$this->length_in_pt($this->border_bottom_right_radius, 10); |
|
1733 | + $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, 10); |
|
1734 | 1734 | |
1735 | 1735 | $this->has_border_radius_cache = $tl + $tr + $br + $bl > 0; |
1736 | 1736 | return $this->has_border_radius_cache; |
@@ -1763,10 +1763,10 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | // Resolve percentages relative to width, as long as we have no support |
1765 | 1765 | // for per-axis radii |
1766 | - $tl = (float) $this->length_in_pt($this->border_top_left_radius, $w); |
|
1767 | - $tr = (float) $this->length_in_pt($this->border_top_right_radius, $w); |
|
1768 | - $br = (float) $this->length_in_pt($this->border_bottom_right_radius, $w); |
|
1769 | - $bl = (float) $this->length_in_pt($this->border_bottom_left_radius, $w); |
|
1766 | + $tl = (float)$this->length_in_pt($this->border_top_left_radius, $w); |
|
1767 | + $tr = (float)$this->length_in_pt($this->border_top_right_radius, $w); |
|
1768 | + $br = (float)$this->length_in_pt($this->border_bottom_right_radius, $w); |
|
1769 | + $bl = (float)$this->length_in_pt($this->border_bottom_left_radius, $w); |
|
1770 | 1770 | |
1771 | 1771 | if ($tl + $tr + $br + $bl > 0) { |
1772 | 1772 | [$rx, $ry, $rw, $rh] = $render_box; |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | |
1910 | 1910 | foreach ($matches as $match) { |
1911 | 1911 | $counter = $match[1]; |
1912 | - $value = isset($match[2]) ? (int) $match[2] : $default; |
|
1912 | + $value = isset($match[2]) ? (int)$match[2] : $default; |
|
1913 | 1913 | $counters[$counter] = $value; |
1914 | 1914 | } |
1915 | 1915 | |
@@ -2594,7 +2594,7 @@ discard block |
||
2594 | 2594 | |
2595 | 2595 | // Compute number values to string and lengths to float (in pt) |
2596 | 2596 | if (is_numeric($val)) { |
2597 | - return (string) $val; |
|
2597 | + return (string)$val; |
|
2598 | 2598 | } |
2599 | 2599 | |
2600 | 2600 | $font_size = $this->__get("font_size"); |
@@ -3310,7 +3310,7 @@ discard block |
||
3310 | 3310 | |
3311 | 3311 | $values = preg_split("/\s+/", $computed); |
3312 | 3312 | |
3313 | - $values = array_map(function ($value) { |
|
3313 | + $values = array_map(function($value) { |
|
3314 | 3314 | if (in_array($value, ["top", "left"])) { |
3315 | 3315 | return 0; |
3316 | 3316 | } else if (in_array($value, ["bottom", "right"])) { |
@@ -3379,7 +3379,7 @@ discard block |
||
3379 | 3379 | $integer = self::CSS_INTEGER; |
3380 | 3380 | |
3381 | 3381 | if (preg_match("/^$integer$/", $val)) { |
3382 | - return (int) $val; |
|
3382 | + return (int)$val; |
|
3383 | 3383 | } |
3384 | 3384 | |
3385 | 3385 | return null; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | // Determine the frame width including margin, padding & border |
147 | 147 | $visible_text = preg_replace('/\xAD/u', "", $text); |
148 | 148 | $text_width = $fontMetrics->getTextWidth($visible_text, $font, $size, $word_spacing, $letter_spacing); |
149 | - $mbp_width = (float) $style->length_in_pt([ |
|
149 | + $mbp_width = (float)$style->length_in_pt([ |
|
150 | 150 | $style->margin_left, |
151 | 151 | $style->border_left_width, |
152 | 152 | $style->padding_left, |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } else { |
516 | 516 | // Find the longest word |
517 | 517 | $words = preg_split(self::$_wordbreak_pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
518 | - $lengths = array_map(function ($chunk) use ($fontMetrics, $font, $size, $word_spacing, $letter_spacing) { |
|
518 | + $lengths = array_map(function($chunk) use ($fontMetrics, $font, $size, $word_spacing, $letter_spacing) { |
|
519 | 519 | // Allow trailing white space to overflow. As in actual |
520 | 520 | // layout above, only handle a single space for now |
521 | 521 | $sep = $chunk[1] ?? ""; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | ]; |
577 | 577 | |
578 | 578 | // The containing block is not defined yet, treat percentages as 0 |
579 | - $delta = (float) $style->length_in_pt($dims, 0); |
|
579 | + $delta = (float)$style->length_in_pt($dims, 0); |
|
580 | 580 | $min += $delta; |
581 | 581 | $max += $delta; |
582 | 582 |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $frame_font_size = $frame->get_dompdf()->getFontMetrics()->getFontHeight($font, $size); |
74 | 74 | $word_spacing = $frame->get_text_spacing() + $style->word_spacing; |
75 | 75 | $letter_spacing = $style->letter_spacing; |
76 | - $width = (float) $style->width; |
|
76 | + $width = (float)$style->width; |
|
77 | 77 | |
78 | 78 | /*$text = str_replace( |
79 | 79 | array("{PAGE_NUM}"), |
@@ -249,7 +249,7 @@ |
||
249 | 249 | // This is based on the white-space pattern in `FrameReflower\Text`, |
250 | 250 | // i.e. only match on collapsible white space |
251 | 251 | $wsPattern = '/^[^\S\xA0\x{202F}\x{2007}]*$/u'; |
252 | - $validChildOrNull = function ($frame) { |
|
252 | + $validChildOrNull = function($frame) { |
|
253 | 253 | return $frame === null |
254 | 254 | || in_array($frame->get_style()->display, self::VALID_CHILDREN, true); |
255 | 255 | }; |