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

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

IniFileLoader.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 1.78 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\DependencyInjection\Loader;
13   
14  use Symfony\Component\Config\Resource\FileResource;
15  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
16   
17  /**
18   * IniFileLoader loads parameters from INI files.
19   *
20   * @author Fabien Potencier <fabien@symfony.com>
21   */
22  class IniFileLoader extends FileLoader
23  {
24      /**
25       * Loads a resource.
26       *
27       * @param mixed  $file The resource
28       * @param string $type The resource type
29       *
30       * @throws InvalidArgumentException When ini file is not valid
31       */
32      public function load($file, $type = null)
33      {
34          $path = $this->locator->locate($file);
35   
36          $this->container->addResource(new FileResource($path));
37   
38          $result = parse_ini_file($path, true);
39          if (false === $result || array() === $result) {
40              throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $file));
41          }
42   
43          if (isset($result['parameters']) && is_array($result['parameters'])) {
44              foreach ($result['parameters'] as $key => $value) {
45                  $this->container->setParameter($key, $value);
46              }
47          }
48      }
49   
50      /**
51       * Returns true if this class supports the given resource.
52       *
53       * @param mixed  $resource A resource
54       * @param string $type     The resource type
55       *
56       * @return bool    true if this class supports the given resource, false otherwise
57       */
58      public function supports($resource, $type = null)
59      {
60          return is_string($resource) && 'ini' === pathinfo($resource, PATHINFO_EXTENSION);
61      }
62  }
63