HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/DimensionUtility.php.tar
httpdocs/wp-content/plugins/google-listings-and-ads/src/Utility/DimensionUtility.php000064400000002562151550374070033316 0ustar00var/www/vhosts/uyarreklam.com.tr<?php

namespace Automattic\WooCommerce\GoogleListingsAndAds\Utility;

/**
 * A class for dealing with Dimensions.
 *
 * @since 2.4.0
 */
class DimensionUtility {

	/**
	 * Width.
	 *
	 * @var int
	 */
	public int $x;
	/**
	 * Height.
	 *
	 * @var int
	 */
	public int $y;

	/**
	 * DimensionUtility constructor.
	 *
	 * @param int $x Width.
	 * @param int $y Height.
	 */
	public function __construct( int $x, int $y ) {
		$this->x = $x;
		$this->y = $y;
	}

	/**
	 * Checks if the dimension fulfils the minimum size.
	 *
	 * @param DimensionUtility $minimum_size The minimum size.
	 *
	 * @return bool true if the dimension is bigger or equal than the the minimum size otherwise false.
	 */
	public function is_minimum_size( DimensionUtility $minimum_size ): bool {
		return $this->x >= $minimum_size->x && $this->y >= $minimum_size->y;
	}

	/**
	 * Checks if the dimension is equal to the other one with a specific precision.
	 *
	 * @param DimensionUtility $target The dimension to be compared.
	 * @param int|float        $precision The precision to use when comparing the two numbers.
	 *
	 * @return bool true if the dimension is equal than the other one otherwise false.
	 */
	public function equals( DimensionUtility $target, $precision = 1 ): bool {
		return wp_fuzzy_number_match( $this->x, $target->x, $precision ) && wp_fuzzy_number_match( $this->y, $target->y, $precision );
	}
}