Пример #1
0
 /**
  * Find the given file in the list of paths.
  * This protected function makes it easy for subclasses to find within namespaces.
  *
  * @param  string $name File name, may contain multiple parts, like 'en-gb.users'
  * @param  array $paths
  * @return string  The full path of the file found.
  *
  * @throws FileNotFoundException if the file was not found on any of the paths.
  */
 protected function findInPaths($name, $paths)
 {
     foreach ((array) $paths as $path) {
         foreach ($this->getPossibleFileNames($name) as $file) {
             if ($this->filesystem->exists($filePath = "{$path}/{$file}")) {
                 return $filePath;
             }
         }
     }
     throw new FileNotFoundException("File '{$name}' not found.");
 }
Пример #2
0
 /**
  * Reads a file into a string.
  *
  * @param  string $name The file name to load (without extension)
  * @return string
  * @throws FileNotFoundException If the file could not be found
  */
 public function load($name)
 {
     // Get file name (or throws FileNotFoundException)
     $fileName = $this->fileFinder->find($name);
     return $this->filesystem->get($fileName);
 }