mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
c47257568c
commit
23aa23fb60
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user