Skip to content

Commit

Permalink
Update ClassFinder.php
Browse files Browse the repository at this point in the history
Fixed up comments and to-do's
  • Loading branch information
c-harris committed Feb 21, 2020
1 parent 91424b4 commit fa80dad
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/ClassFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ protected static function getProjectClasses(string $namespace): array
return get_declared_classes();
}
$map = self::getClassMap($namespace);
// now class list of maps are assembled, use class_exists calls to explicitly autoload them,
// while not running them
// now thr classmap is assembled, use class_exists calls to explicitly autoload them,
// while not running them. Autoloading allows for caching future results
foreach ($map as $class => $file) {
if (!self::strStartsWith($namespace, $class)) {
continue;
Expand Down Expand Up @@ -152,10 +152,6 @@ public static function getClasses(string $namespace = '', callable $conditional
$conditional,
$includeVendor
) {
/*$dontSkip = true;
if (!$includeVendor) {
$dontSkip = !self::isClassInVendor($class);
}*/
$dontSkip = $includeVendor || !self::isClassInVendor($class);
return substr($class, 0, strlen($namespace)) === $namespace && $dontSkip && $conditional($class) ;
}));
Expand All @@ -172,6 +168,7 @@ protected static function getProjectSearchDirs(string $namespace): array
{
$autoloader = self::getComposerAutoloader();
$raw = $autoloader->getPrefixesPsr4();
//to-do: at the moment this requires the psr4 namespace. Should we search for a parent namespace if the requested on is not present? Also what do we do for empty strings?
return $raw[$namespace];
}

Expand Down

0 comments on commit fa80dad

Please sign in to comment.