game/_incl_data/class/Helper/Comparsion.php

23 lines
466 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
}