src/Core/ClassInfo.php
public static function classes_for_file($filePath)
    {
        $absFilePath = Director::getAbsFile($filePath);
        $classManifest = ClassLoader::inst()->getManifest();
        $classes = $classManifest->getClasses();
        $classNames = $classManifest->getClassNames();

        $matchedClasses = [];
        foreach ($classes as $lowerClass => $compareFilePath) {
            if (strcasecmp($absFilePath, $compareFilePath) === 0) {
                $matchedClasses[$lowerClass] = $classNames[$lowerClass];
            }
        }

        return $matchedClasses;
    }
public static function classes_for_file($filePath)
    {
        $absFilePath = Director::getAbsFile($filePath);
        $classManifest = ClassLoader::inst()->getManifest();
        $classes = $classManifest->getClasses();
        $classNames = $classManifest->getClassNames();

        $matchedClasses = [];
        foreach ($classes as $lowerClass => $compareFilePath) {
            if (strcasecmp($absFilePath, $compareFilePath) === 0) {
                $matchedClasses[$lowerClass] = $classNames[$lowerClass];
            }
        }

        return $matchedClasses;
    }
public static function classes_for_file ( $ filePath ) { $ absFilePath = Director :: getAbsFile ( $ filePath ) ; $ classManifest = ClassLoader :: inst ( ) -> getManifest ( ) ; $ classes = $ classManifest -> getClasses ( ) ; $ classNames = $ classManifest -> getClassNames ( ) ; $ matchedClasses = [ ] ; foreach ( $ classes as $ lowerClass => $ compareFilePath ) { if ( strcasecmp ( $ absFilePath , $ compareFilePath ) === 0 ) { $ matchedClasses [ $ lowerClass ] = $ classNames [ $ lowerClass ] ; } } return $ matchedClasses ; }
Get all classes contained in a file.

@param string $filePath Path to a PHP file (absolute or relative to webroot)
@return array Map of lowercase class names to correct class name
Get all classes contained in a file .