You are here

private function ClassNotFoundFatalErrorHandler::findClassInPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php \Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler::findClassInPath()

Parameters

string $path:

string $class:

string $prefix:

Return value

array

1 call to ClassNotFoundFatalErrorHandler::findClassInPath()
ClassNotFoundFatalErrorHandler::getClassCandidates in vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
Tries to guess the full namespace for a given class name.

File

vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php, line 140

Class

ClassNotFoundFatalErrorHandler
ErrorHandler for classes that do not exist.

Namespace

Symfony\Component\Debug\FatalErrorHandler

Code

private function findClassInPath($path, $class, $prefix) {
  if (!($path = realpath($path . '/' . strtr($prefix, '\\_', '//')) ?: realpath($path . '/' . dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path))) {
    return array();
  }
  $classes = array();
  $filename = $class . '.php';
  foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if ($filename == $file
      ->getFileName() && ($class = $this
      ->convertFileToClass($path, $file
      ->getPathName(), $prefix))) {
      $classes[] = $class;
    }
  }
  return $classes;
}