/** * Returns the names of the classes declared in a sourcefile. * * @param string $filename * @param string $commonPath * @param boolean $clearCache * @return array * @since Method available since Release 3.2.0 * @todo Find a better place for this method. */ public static function getFunctionsInFile($filename, $commonPath = '', $clearCache = FALSE) { if ($commonPath != '') { $filename = str_replace($commonPath, '', $filename); } if ($clearCache) { self::$fileFunctionMap = array(); } if (empty(self::$fileFunctionMap)) { $functions = get_defined_functions(); foreach ($functions['user'] as $functionName) { $function = new ReflectionFunction($functionName); $file = $function->getFileName(); if ($commonPath != '') { $file = str_replace($commonPath, '', $file); } if (!isset(self::$fileFunctionMap[$file])) { self::$fileFunctionMap[$file] = array($function); } else { self::$fileFunctionMap[$file][] = $function; } } } return isset(self::$fileFunctionMap[$filename]) ? self::$fileFunctionMap[$filename] : array(); }