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.
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: 02.04.2025, 15:03 - Dateigröße: 2.33 KiB


001  <?php
002   
003  /*
004   * This file is part of the Symfony package.
005   *
006   * (c) Fabien Potencier <fabien@symfony.com>
007   *
008   * For the full copyright and license information, please view the LICENSE
009   * file that was distributed with this source code.
010   */
011   
012  namespace Symfony\Component\HttpKernel\Config;
013   
014  use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
015   
016  /**
017   * EnvParametersResource represents resources stored in prefixed environment variables.
018   *
019   * @author Chris Wilkinson <chriswilkinson84@gmail.com>
020   *
021   * @deprecated since version 3.4, to be removed in 4.0
022   */
023  class EnvParametersResource implements SelfCheckingResourceInterface, \Serializable
024  {
025      /**
026       * @var string
027       */
028      private $prefix;
029   
030      /**
031       * @var string
032       */
033      private $variables;
034   
035      /**
036       * @param string $prefix
037       */
038      public function __construct($prefix)
039      {
040          $this->prefix = $prefix;
041          $this->variables = $this->findVariables();
042      }
043   
044      /**
045       * {@inheritdoc}
046       */
047      public function __toString()
048      {
049          return serialize($this->getResource());
050      }
051   
052      /**
053       * @return array An array with two keys: 'prefix' for the prefix used and 'variables' containing all the variables watched by this resource
054       */
055      public function getResource()
056      {
057          return ['prefix' => $this->prefix, 'variables' => $this->variables];
058      }
059   
060      /**
061       * {@inheritdoc}
062       */
063      public function isFresh($timestamp)
064      {
065          return $this->findVariables() === $this->variables;
066      }
067   
068      /**
069       * @internal
070       */
071      public function serialize()
072      {
073          return serialize(['prefix' => $this->prefix, 'variables' => $this->variables]);
074      }
075   
076      /**
077       * @internal
078       */
079      public function unserialize($serialized)
080      {
081          if (\PHP_VERSION_ID >= 70000) {
082              $unserialized = unserialize($serialized, ['allowed_classes' => false]);
083          } else {
084              $unserialized = unserialize($serialized);
085          }
086   
087          $this->prefix = $unserialized['prefix'];
088          $this->variables = $unserialized['variables'];
089      }
090   
091      private function findVariables()
092      {
093          $variables = [];
094   
095          foreach ($_SERVER as $key => $value) {
096              if (0 === strpos($key, $this->prefix)) {
097                  $variables[$key] = $value;
098              }
099          }
100   
101          ksort($variables);
102   
103          return $variables;
104      }
105  }
106