/** * Find the given view in the list of paths. * * @param string $name * @param array $paths * @return string * * @throws \InvalidArgumentException */ protected function findInPaths($name, $paths) { $paths = \WebAPL\Template::preparePaths($paths); foreach ($paths as $path) { foreach ($this->getPossibleViewFiles($name) as $file) { if ($this->files->exists($viewPath = $path . '/' . $file)) { return $viewPath; } } } throw new \InvalidArgumentException("View [{$name}] not found."); }