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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
FileLoader.php
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\Config\Loader;
013
014 use Symfony\Component\Config\FileLocatorInterface;
015 use Symfony\Component\Config\Exception\FileLoaderLoadException;
016 use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
017
018 /**
019 * FileLoader is the abstract class used by all built-in loaders that are file based.
020 *
021 * @author Fabien Potencier <fabien@symfony.com>
022 */
023 abstract class FileLoader extends Loader
024 {
025 protected static $loading = array();
026
027 protected $locator;
028
029 private $currentDir;
030
031 /**
032 * Constructor.
033 *
034 * @param FileLocatorInterface $locator A FileLocatorInterface instance
035 */
036 public function __construct(FileLocatorInterface $locator)
037 {
038 $this->locator = $locator;
039 }
040
041 public function setCurrentDir($dir)
042 {
043 $this->currentDir = $dir;
044 }
045
046 public function getLocator()
047 {
048 return $this->locator;
049 }
050
051 /**
052 * Imports a resource.
053 *
054 * @param mixed $resource A Resource
055 * @param string $type The resource type
056 * @param bool $ignoreErrors Whether to ignore import errors or not
057 * @param string $sourceResource The original resource importing the new resource
058 *
059 * @return mixed
060 *
061 * @throws FileLoaderLoadException
062 * @throws FileLoaderImportCircularReferenceException
063 */
064 public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
065 {
066 try {
067 $loader = $this->resolve($resource, $type);
068
069 if ($loader instanceof FileLoader && null !== $this->currentDir) {
070 // we fallback to the current locator to keep BC
071 // as some some loaders do not call the parent __construct()
072 // @deprecated should be removed in 3.0
073 $locator = $loader->getLocator() ?: $this->locator;
074 $resource = $locator->locate($resource, $this->currentDir, false);
075 }
076
077 $resources = is_array($resource) ? $resource : array($resource);
078 for ($i = 0; $i < $resourcesCount = count($resources); $i++ ) {
079 if (isset(self::$loading[$resources[$i]])) {
080 if ($i == $resourcesCount-1) {
081 throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
082 }
083 } else {
084 $resource = $resources[$i];
085 break;
086 }
087 }
088 self::$loading[$resource] = true;
089
090 $ret = $loader->load($resource, $type);
091
092 unset(self::$loading[$resource]);
093
094 return $ret;
095 } catch (FileLoaderImportCircularReferenceException $e) {
096 throw $e;
097 } catch (\Exception $e) {
098 if (!$ignoreErrors) {
099 // prevent embedded imports from nesting multiple exceptions
100 if ($e instanceof FileLoaderLoadException) {
101 throw $e;
102 }
103
104 throw new FileLoaderLoadException($resource, $sourceResource, null, $e);
105 }
106 }
107 }
108 }
109