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

EnvParametersResource.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 1.98 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\HttpKernel\Config;
13   
14  use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
15   
16  /**
17   * EnvParametersResource represents resources stored in prefixed environment variables.
18   *
19   * @author Chris Wilkinson <chriswilkinson84@gmail.com>
20   */
21  class EnvParametersResource implements SelfCheckingResourceInterface, \Serializable
22  {
23      /**
24       * @var string
25       */
26      private $prefix;
27   
28      /**
29       * @var string
30       */
31      private $variables;
32   
33      /**
34       * Constructor.
35       *
36       * @param string $prefix
37       */
38      public function __construct($prefix)
39      {
40          $this->prefix = $prefix;
41          $this->variables = $this->findVariables();
42      }
43   
44      /**
45       * {@inheritdoc}
46       */
47      public function __toString()
48      {
49          return serialize($this->getResource());
50      }
51   
52      /**
53       * {@inheritdoc}
54       */
55      public function getResource()
56      {
57          return array('prefix' => $this->prefix, 'variables' => $this->variables);
58      }
59   
60      /**
61       * {@inheritdoc}
62       */
63      public function isFresh($timestamp)
64      {
65          return $this->findVariables() === $this->variables;
66      }
67   
68      public function serialize()
69      {
70          return serialize(array('prefix' => $this->prefix, 'variables' => $this->variables));
71      }
72   
73      public function unserialize($serialized)
74      {
75          $unserialized = unserialize($serialized);
76   
77          $this->prefix = $unserialized['prefix'];
78          $this->variables = $unserialized['variables'];
79      }
80   
81      private function findVariables()
82      {
83          $variables = array();
84   
85          foreach ($_SERVER as $key => $value) {
86              if (0 === strpos($key, $this->prefix)) {
87                  $variables[$key] = $value;
88              }
89          }
90   
91          ksort($variables);
92   
93          return $variables;
94      }
95  }
96