#!/usr/bin/php [options]\n", $argv[0]); printf("Options: -f :The name of the file you wish do double check.\n"); //printf(" -s on :Smart Mode - Attempts to guess OOP related variables.\n"); printf(" -m on :Method Clean - Attempts to cleanup method declarations.\n"); exit(); } /** * Prints the contents of the data set beneath the header message. * * @parram array A data set. * @param string A header message for the user. */ function displaySet($set, $msg) { printf("$msg\n"); while(list($var, $count) = each($set)) { printf(" %s => %u\n",$var, $count); } } /** * Takes our data set and cleans it up, honoring counts. * * @param array A data set to manipulate. * @return array A cleaned up data set. */ function organizeSet($set) { $rSet = array(); for($i=0; $i[A-Za-z0-9_]+(\[([0-9]+|[\'\"][^\'\"]+[\'\"])\])*)*(\([^\)]*\))?", $buffer, $match)) { $buffer = str_replace($match[0], '', $buffer, $count); if ( ereg("\([^\)]*\)$", $match[0]) ) { $methods[] = array($match[0], $count); } else { $vars[] = array($match[0], $count); } } /* Attempt to clean up methods. */ if ($isMethodMode) { for ($i=0; $i < count($methods); $i++) { $methods[$i][0] = ereg_replace("\([aA-zZ0-9_$&%^*/+-:;, \n\r\].*[)]", "", $methods[$i][0]); $methods[$i][0] = str_replace('()', '', $methods[$i][0]); } } $varSet = organizeSet($vars); $methSet = organizeSet($methods); ksort($varSet); ksort($methSet); displaySet($varSet, "\n[Variables => Count]"); displaySet($methSet, "\n[Methods => Count]"); } else { throwUsage($argv); }