42 lines
674 B
PHP
42 lines
674 B
PHP
<?php
|
|
|
|
class Range implements \JsonSerializable
|
|
{
|
|
private $min;
|
|
private $max;
|
|
|
|
public function __construct($min = null, $max = null)
|
|
{
|
|
$this->min = $min;
|
|
$this->max = $max;
|
|
}
|
|
|
|
public function min()
|
|
{
|
|
return $this->min;
|
|
}
|
|
|
|
public function max()
|
|
{
|
|
return $this->max;
|
|
}
|
|
|
|
public function isNull()
|
|
{
|
|
return $this->min === null && $this->max === null;
|
|
}
|
|
|
|
public function isNotNull()
|
|
{
|
|
return !$this->isNull();
|
|
}
|
|
|
|
public function jsonSerialize(): mixed
|
|
{
|
|
return [
|
|
'min' => $this->min,
|
|
'max' => $this->max,
|
|
];
|
|
}
|
|
}
|