Skip to content

Commit 63128a8

Browse files
committed
Refactor: Replace min/max logic with clamp function
1 parent 14369b5 commit 63128a8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/block-supports/typography.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ function wp_get_typography_font_size_value( $preset, $settings = array() ) {
669669
* For a - b * log2(), lower values of b will make the curve move towards the minimum faster.
670670
* The scale factor is constrained between min and max values.
671671
*/
672-
$minimum_font_size_factor = min( max( 1 - 0.075 * log( $preferred_font_size_in_px, 2 ), $default_minimum_font_size_factor_min ), $default_minimum_font_size_factor_max );
672+
$minimum_font_size_factor = clamp( 1 - 0.075 * log( $preferred_font_size_in_px, 2 ), $default_minimum_font_size_factor_min, $default_minimum_font_size_factor_max );
673673
$calculated_minimum_font_size = round( $preferred_size['value'] * $minimum_font_size_factor, 3 );
674674

675675
// Only use calculated min font size if it's > $minimum_font_size_limit value.

src/wp-includes/embed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ function get_oembed_response_data( $post, $width ) {
594594
)
595595
);
596596

597-
$width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] );
597+
$width = clamp( $width, $min_max_width['min'], $min_max_width['max'] );
598598
$height = max( (int) ceil( $width / 16 * 9 ), 200 );
599599

600600
$data = array(

0 commit comments

Comments
 (0)