Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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 |
CompositeNamingStrategy.php
01 <?php
02 /**
03 * Zend Framework (http://framework.zend.com/)
04 *
05 * @link http://github.com/zendframework/zf2 for the canonical source repository
06 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
07 * @license http://framework.zend.com/license/new-bsd New BSD License
08 */
09
10 namespace Zend\Stdlib\Hydrator\NamingStrategy;
11
12 final class CompositeNamingStrategy implements NamingStrategyInterface
13 {
14 /**
15 * @var array
16 */
17 private $namingStrategies = array();
18
19 /**
20 * @var NamingStrategyInterface
21 */
22 private $defaultNamingStrategy;
23
24 /**
25 * @param NamingStrategyInterface[] $strategies indexed by the name they translate
26 * @param NamingStrategyInterface|null $defaultNamingStrategy
27 */
28 public function __construct(array $strategies, NamingStrategyInterface $defaultNamingStrategy = null)
29 {
30 $this->namingStrategies = array_map(
31 function (NamingStrategyInterface $strategy) {
32 // this callback is here only to ensure type-safety
33 return $strategy;
34 },
35 $strategies
36 );
37
38 $this->defaultNamingStrategy = $defaultNamingStrategy ?: new IdentityNamingStrategy();
39 }
40
41 /**
42 * {@inheritDoc}
43 */
44 public function extract($name)
45 {
46 $strategy = isset($this->namingStrategies[$name])
47 ? $this->namingStrategies[$name]
48 : $this->defaultNamingStrategy;
49
50 return $strategy->extract($name);
51 }
52
53 /**
54 * {@inheritDoc}
55 */
56 public function hydrate($name)
57 {
58 $strategy = isset($this->namingStrategies[$name])
59 ? $this->namingStrategies[$name]
60 : $this->defaultNamingStrategy;
61
62 return $strategy->hydrate($name);
63 }
64 }
65