No more use of _ to mark private variables.

This commit is contained in:
2023-08-01 14:02:12 +00:00
parent c8c126962d
commit f0aa9413e1
8 changed files with 87 additions and 94 deletions

View File

@ -9,28 +9,21 @@ use Exception;
class Range
{
private int $_min;
private int $_max;
public function __construct(int $min, int $max)
public function __construct(private int $min, private int $max)
{
if ($min > $max) {
throw new Exception('min > max');
}
$this->_min = $min;
$this->_max = $max;
}
public function getMin(): int
{
return $this->_min;
return $this->min;
}
public function getMax(): int
{
return $this->_max;
return $this->max;
}
protected static function create(int $min, int $max): self
@ -57,6 +50,6 @@ class Range
public function isInRange(int $value): bool
{
return ($this->_min <= $value) && ($value <= $this->_max);
return ($this->min <= $value) && ($value <= $this->max);
}
}