Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / config / FileLocator.php
index 6b686390bc296ac2966c243bdc16234f63e7092c..f5593cbbe2550911ddac78dd4818486ea9b49af1 100644 (file)
@@ -23,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())
@@ -43,7 +41,7 @@ class FileLocator implements FileLocatorInterface
 
         if ($this->isAbsolutePath($name)) {
             if (!file_exists($name)) {
-                throw new FileLocatorFileNotFoundException(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;
@@ -56,7 +54,7 @@ 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)) {
@@ -64,11 +62,13 @@ class FileLocator implements FileLocatorInterface
                     return $file;
                 }
                 $filepaths[] = $file;
+            } else {
+                $notfound[] = $file;
             }
         }
 
         if (!$filepaths) {
-            throw new FileLocatorFileNotFoundException(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;
@@ -83,10 +83,10 @@ class FileLocator implements FileLocatorInterface
      */
     private function isAbsolutePath($file)
     {
-        if ($file[0] === '/' || $file[0] === '\\'
+        if ('/' === $file[0] || '\\' === $file[0]
             || (strlen($file) > 3 && ctype_alpha($file[0])
-                && $file[1] === ':'
-                && ($file[2] === '\\' || $file[2] === '/')
+                && ':' === $file[1]
+                && ('\\' === $file[2] || '/' === $file[2])
             )
             || null !== parse_url($file, PHP_URL_SCHEME)
         ) {