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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Processor.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 2.79 KiB


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;
13   
14  /**
15   * This class is the entry point for config normalization/merging/finalization.
16   *
17   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
18   */
19  class Processor
20  {
21      /**
22       * Processes an array of configurations.
23       *
24       * @param NodeInterface $configTree The node tree describing the configuration
25       * @param array         $configs    An array of configuration items to process
26       *
27       * @return array The processed configuration
28       */
29      public function process(NodeInterface $configTree, array $configs)
30      {
31          $currentConfig = array();
32          foreach ($configs as $config) {
33              $config = $configTree->normalize($config);
34              $currentConfig = $configTree->merge($currentConfig, $config);
35          }
36   
37          return $configTree->finalize($currentConfig);
38      }
39   
40      /**
41       * Processes an array of configurations.
42       *
43       * @param ConfigurationInterface $configuration The configuration class
44       * @param array                  $configs       An array of configuration items to process
45       *
46       * @return array The processed configuration
47       */
48      public function processConfiguration(ConfigurationInterface $configuration, array $configs)
49      {
50          return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs);
51      }
52   
53      /**
54       * Normalizes a configuration entry.
55       *
56       * This method returns a normalize configuration array for a given key
57       * to remove the differences due to the original format (YAML and XML mainly).
58       *
59       * Here is an example.
60       *
61       * The configuration in XML:
62       *
63       * <twig:extension>twig.extension.foo</twig:extension>
64       * <twig:extension>twig.extension.bar</twig:extension>
65       *
66       * And the same configuration in YAML:
67       *
68       * extensions: ['twig.extension.foo', 'twig.extension.bar']
69       *
70       * @param array  $config A config array
71       * @param string $key    The key to normalize
72       * @param string $plural The plural form of the key if it is irregular
73       *
74       * @return array
75       */
76      public static function normalizeConfig($config, $key, $plural = null)
77      {
78          if (null === $plural) {
79              $plural = $key.'s';
80          }
81   
82          if (isset($config[$plural])) {
83              return $config[$plural];
84          }
85   
86          if (isset($config[$key])) {
87              if (is_string($config[$key]) || !is_int(key($config[$key]))) {
88                  // only one
89                  return  array($config[$key]);
90              }
91   
92              return  $config[$key];
93          }
94   
95          return array();
96      }
97  }
98