X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconfig%2FFileLocator.php;h=2c9cea047c2a426fb9afe79730438b289558addc;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=4816724c8190eb9028b4b9daf525b96d752803a2;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/config/FileLocator.php b/vendor/symfony/config/FileLocator.php index 4816724c8..2c9cea047 100644 --- a/vendor/symfony/config/FileLocator.php +++ b/vendor/symfony/config/FileLocator.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Config; +use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; + /** * FileLocator uses an array of pre-defined paths to find files. * @@ -21,8 +23,6 @@ class FileLocator implements FileLocatorInterface protected $paths; /** - * Constructor. - * * @param string|array $paths A path or an array of paths where to look for resources */ public function __construct($paths = array()) @@ -41,7 +41,7 @@ class FileLocator implements FileLocatorInterface if ($this->isAbsolutePath($name)) { if (!file_exists($name)) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $name)); + throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist.', $name), 0, null, array($name)); } return $name; @@ -54,19 +54,21 @@ class FileLocator implements FileLocatorInterface } $paths = array_unique($paths); - $filepaths = array(); + $filepaths = $notfound = array(); foreach ($paths as $path) { - if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { + if (@file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) { if (true === $first) { return $file; } $filepaths[] = $file; + } else { + $notfound[] = $file; } } if (!$filepaths) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths))); + throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: %s).', $name, implode(', ', $paths)), 0, null, $notfound); } return $filepaths; @@ -81,10 +83,10 @@ class FileLocator implements FileLocatorInterface */ private function isAbsolutePath($file) { - if ($file[0] === '/' || $file[0] === '\\' - || (strlen($file) > 3 && ctype_alpha($file[0]) - && $file[1] === ':' - && ($file[2] === '\\' || $file[2] === '/') + if ('/' === $file[0] || '\\' === $file[0] + || (\strlen($file) > 3 && ctype_alpha($file[0]) + && ':' === $file[1] + && ('\\' === $file[2] || '/' === $file[2]) ) || null !== parse_url($file, PHP_URL_SCHEME) ) {