first commit
This commit is contained in:
41
class/class.Range.php
Normal file
41
class/class.Range.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user