Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
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 |
EnumNodeDefinition.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Config\Definition\Builder;
13
14 use Symfony\Component\Config\Definition\EnumNode;
15
16 /**
17 * Enum Node Definition.
18 *
19 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
20 */
21 class EnumNodeDefinition extends ScalarNodeDefinition
22 {
23 private $values;
24
25 public function values(array $values)
26 {
27 $values = array_unique($values);
28
29 if (count($values) <= 1) {
30 throw new \InvalidArgumentException('->values() must be called with at least two distinct values.');
31 }
32
33 $this->values = $values;
34
35 return $this;
36 }
37
38 /**
39 * Instantiate a Node
40 *
41 * @return EnumNode The node
42 *
43 * @throws \RuntimeException
44 */
45 protected function instantiateNode()
46 {
47 if (null === $this->values) {
48 throw new \RuntimeException('You must call ->values() on enum nodes.');
49 }
50
51 return new EnumNode($this->name, $this->parent, $this->values);
52 }
53 }
54