ENHANCEMENT Added ClassInfo::classes_for_file()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64489 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-17 15:18:26 +00:00
parent c47257568c
commit 23aa23fb60

View File

@ -155,5 +155,24 @@ class ClassInfo {
global $_ALL_CLASSES;
return isset($_ALL_CLASSES['implementors'][$interfaceName]) ? in_array($className, $_ALL_CLASSES['implementors'][$interfaceName]) : false;
}
/**
* Get all classes contained in a file.
* @uses ManifestBuilder
*
* @param string $filePath Path to a PHP file (absolute or relative to webroot)
* @return array
*/
static function classes_for_file($filePath) {
$absFilePath = Director::getAbsFile($filePath);
global $_CLASS_MANIFEST;
$matchedClasses = array();
foreach($_CLASS_MANIFEST as $class => $compareFilePath) {
if($absFilePath == $compareFilePath) $matchedClasses[] = $class;
}
return $matchedClasses;
}
}
?>