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 |
FileLoaderLoadException.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\Exception;
013
014 /**
015 * Exception class for when a resource cannot be loaded or imported.
016 *
017 * @author Ryan Weaver <ryan@thatsquality.com>
018 */
019 class FileLoaderLoadException extends \Exception
020 {
021 /**
022 * @param string $resource The resource that could not be imported
023 * @param string $sourceResource The original resource importing the new resource
024 * @param int $code The error code
025 * @param \Exception $previous A previous exception
026 */
027 public function __construct($resource, $sourceResource = null, $code = null, $previous = null)
028 {
029 $message = '';
030 if ($previous) {
031 // Include the previous exception, to help the user see what might be the underlying cause
032
033 // Trim the trailing period of the previous message. We only want 1 period remove so no rtrim...
034 if ('.' === substr($previous->getMessage(), -1)) {
035 $trimmedMessage = substr($previous->getMessage(), 0, -1);
036 $message .= sprintf('%s', $trimmedMessage).' in ';
037 } else {
038 $message .= sprintf('%s', $previous->getMessage()).' in ';
039 }
040 $message .= $resource.' ';
041
042 // show tweaked trace to complete the human readable sentence
043 if (null === $sourceResource) {
044 $message .= sprintf('(which is loaded in resource "%s")', $this->varToString($resource));
045 } else {
046 $message .= sprintf('(which is being imported from "%s")', $this->varToString($sourceResource));
047 }
048 $message .= '.';
049
050 // if there's no previous message, present it the default way
051 } elseif (null === $sourceResource) {
052 $message .= sprintf('Cannot load resource "%s".', $this->varToString($resource));
053 } else {
054 $message .= sprintf('Cannot import resource "%s" from "%s".', $this->varToString($resource), $this->varToString($sourceResource));
055 }
056
057 // Is the resource located inside a bundle?
058 if ('@' === $resource[0]) {
059 $parts = explode(DIRECTORY_SEPARATOR, $resource);
060 $bundle = substr($parts[0], 1);
061 $message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
062 $message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource);
063 }
064
065 parent::__construct($message, $code, $previous);
066 }
067
068 protected function varToString($var)
069 {
070 if (is_object($var)) {
071 return sprintf('Object(%s)', get_class($var));
072 }
073
074 if (is_array($var)) {
075 $a = array();
076 foreach ($var as $k => $v) {
077 $a[] = sprintf('%s => %s', $k, $this->varToString($v));
078 }
079
080 return sprintf('Array(%s)', implode(', ', $a));
081 }
082
083 if (is_resource($var)) {
084 return sprintf('Resource(%s)', get_resource_type($var));
085 }
086
087 if (null === $var) {
088 return 'null';
089 }
090
091 if (false === $var) {
092 return 'false';
093 }
094
095 if (true === $var) {
096 return 'true';
097 }
098
099 return (string) $var;
100 }
101 }
102