FuelPHP Bin
private static function classes_and_methods_in_file($filepath) { $php_code = file_get_contents($filepath); $classes = array(); $tokens = token_get_all($php_code); $count = count($tokens); $class_name = false; for ($i = 4; $i < $count; $i++) { // get classes if ( $tokens[$i - 4][0] == T_CLASS && $tokens[$i - 3][0] == T_WHITESPACE && $tokens[$i-2][0] == T_STRING) { $class_name = $tokens[$i-2][1]; } // get methodes if($class_name && $tokens[$i-4][0] == T_PUBLIC && $tokens[$i-3][0] == T_WHITESPACE && $tokens[$i-2][0] == T_FUNCTION && $tokens[$i-1][0] == T_WHITESPACE && $tokens[$i][0] == T_STRING ) { $classes[$class_name][] = $tokens[$i][1]; } } return $classes; }