ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ClosedFloatInterval.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
10 
12 
14 {
18  private $range;
19 
25  public function __construct($minimum, $maximum)
26  {
27  if ($maximum === $minimum) {
29  sprintf('The maximum("%s") and minimum("%s") can NOT be the same', $maximum, $minimum),
30  'exception_maximum_minimum_same',
31  $maximum,
32  $minimum
33  );
34  }
35 
36  $this->range = new OpenedFloatInterval($minimum, $maximum);
37  }
38 
43  public function spans(float $numberToCheck) : bool
44  {
45  if ($numberToCheck <= $this->range->minimum()) {
46  return false;
47  } elseif ($numberToCheck >= $this->range->maximum()) {
48  return false;
49  }
50 
51  return true;
52  }
53 
57  public function minimum() : float
58  {
59  return $this->range->minimum();
60  }
61 
65  public function maximum() : float
66  {
67  return $this->range->maximum();
68  }
69 }