23 lines
438 B
PHP
23 lines
438 B
PHP
<?php
|
|
|
|
namespace Helper;
|
|
|
|
class Comparsion
|
|
{
|
|
/** Íå äà¸ò çíà÷åíèþ âûéòè çà ïðåäåëû.
|
|
* @param $value
|
|
* @param $minimum
|
|
* @param $maximum
|
|
* @return mixed
|
|
*/
|
|
public static function minimax($value, $minimum, $maximum): mixed
|
|
{
|
|
if ($value < $minimum) {
|
|
$value = $minimum;
|
|
}
|
|
if ($value > $maximum) {
|
|
$value = $maximum;
|
|
}
|
|
return $value;
|
|
}
|
|
} |