ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
PageReadingTime.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilException;
24 
26 {
27  private readonly int $minutes;
28 
29  public function __construct(int $minutes)
30  {
31  if ($minutes < 0) {
32  throw new ilException('The reading time MUST be a positive integer!');
33  }
34 
35  if ($minutes > PHP_INT_MAX) {
36  throw new ilException('The reading time MUST NOT exceed the maximum integer!');
37  }
38 
39  $this->minutes = $minutes;
40  }
41 
42  public function minutes(): int
43  {
44  return $this->minutes;
45  }
46 }