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. |
|
(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 /**
026 * @var array
027 */
028 protected static $loading = array();
029
030 /**
031 * @var FileLocatorInterface
032 */
033 protected $locator;
034
035 private $currentDir;
036
037 /**
038 * Constructor.
039 *
040 * @param FileLocatorInterface $locator A FileLocatorInterface instance
041 */
042 public function __construct(FileLocatorInterface $locator)
043 {
044 $this->locator = $locator;
045 }
046
047 /**
048 * Sets the current directory.
049 *
050 * @param string $dir
051 */
052 public function setCurrentDir($dir)
053 {
054 $this->currentDir = $dir;
055 }
056
057 /**
058 * Returns the file locator used by this loader.
059 *
060 * @return FileLocatorInterface
061 */
062 public function getLocator()
063 {
064 return $this->locator;
065 }
066
067 /**
068 * Imports a resource.
069 *
070 * @param mixed $resource A Resource
071 * @param string|null $type The resource type or null if unknown
072 * @param bool $ignoreErrors Whether to ignore import errors or not
073 * @param string|null $sourceResource The original resource importing the new resource
074 *
075 * @return mixed
076 *
077 * @throws FileLoaderLoadException
078 * @throws FileLoaderImportCircularReferenceException
079 */
080 public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
081 {
082 try {
083 $loader = $this->resolve($resource, $type);
084
085 if ($loader instanceof self && null !== $this->currentDir) {
086 // we fallback to the current locator to keep BC
087 // as some some loaders do not call the parent __construct()
088 // @deprecated should be removed in 3.0
089 $locator = $loader->getLocator();
090 if (null === $locator) {
091 @trigger_error('Not calling the parent constructor in '.get_class($loader).' which extends '.__CLASS__.' is deprecated since version 2.7 and will not be supported anymore in 3.0.', E_USER_DEPRECATED);
092 $locator = $this->locator;
093 }
094
095 $resource = $locator->locate($resource, $this->currentDir, false);
096 }
097
098 $resources = is_array($resource) ? $resource : array($resource);
099 for ($i = 0; $i < $resourcesCount = count($resources); ++$i) {
100 if (isset(self::$loading[$resources[$i]])) {
101 if ($i == $resourcesCount - 1) {
102 throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
103 }
104 } else {
105 $resource = $resources[$i];
106 break;
107 }
108 }
109 self::$loading[$resource] = true;
110
111 try {
112 $ret = $loader->load($resource, $type);
113 } catch (\Exception $e) {
114 unset(self::$loading[$resource]);
115 throw $e;
116 } catch (\Throwable $e) {
117 unset(self::$loading[$resource]);
118 throw $e;
119 }
120
121 unset(self::$loading[$resource]);
122
123 return $ret;
124 } catch (FileLoaderImportCircularReferenceException $e) {
125 throw $e;
126 } catch (\Exception $e) {
127 if (!$ignoreErrors) {
128 // prevent embedded imports from nesting multiple exceptions
129 if ($e instanceof FileLoaderLoadException) {
130 throw $e;
131 }
132
133 throw new FileLoaderLoadException($resource, $sourceResource, null, $e);
134 }
135 }
136 }
137 }
138