Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
BaseImplementation.php
01 <?php declare(strict_types=1);
02
03 /**
04 * @package s9e\RegexpBuilder
05 * @copyright Copyright (c) 2016-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\RegexpBuilder\Output;
09
10 use InvalidArgumentException;
11
12 abstract class BaseImplementation implements OutputInterface
13 {
14 /**
15 * @var integer
16 */
17 protected $maxValue = 0;
18
19 /**
20 * @var integer
21 */
22 protected $minValue = 0;
23
24 /**
25 * @param array $options
26 */
27 public function __construct(array $options = [])
28 {
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function output(int $value): string
35 {
36 $this->validate($value);
37
38 return $this->outputValidValue($value);
39 }
40
41 /**
42 * Validate given value
43 *
44 * @param integer $value
45 * @return void
46 */
47 protected function validate(int $value): void
48 {
49 if ($value < $this->minValue || $value > $this->maxValue)
50 {
51 throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
52 }
53 }
54
55 /**
56 * Serialize a valid value into a character
57 *
58 * @param integer $value
59 * @return string
60 */
61 abstract protected function outputValidValue(int $value): string;
62 }