/** * Returns a singleton instance * * @static * @access public * @return void */ public static function getInstance() { if (NULL === self::$_instance) { self::$_instance = new App_Cli_FlagFlippers(); } return self::$_instance; }
} closedir($dir); } } $resources = array(); foreach ($files as $file) { $filepath = $path . DIRECTORY_SEPARATOR . $file; require_once $filepath; $reflectionFile = new Zend_Reflection_File($filepath); foreach ($reflectionFile->getClasses() as $class) { $classInfo = array('description' => $class->getDocblock()->getShortDescription(), 'name' => strtolower($module) . '-' . App_Inflector::convertControllerName($class->getName()), 'methods' => array()); foreach ($class->getMethods() as $method) { if (substr($method->getName(), -6) == 'Action') { $classInfo['methods'][] = array('description' => $method->getDocblock()->getShortDescription(), 'name' => App_Inflector::convertActionName($method->getName())); } } $resources[] = $classInfo; } } $flagFlippers = App_Cli_FlagFlippers::getInstance(); $inserts = $flagFlippers->generateInserts($resources); if (empty($inserts)) { echo 'No new flags / privileges found.'; exit; } $date = new Zend_Date(); echo '-- Flag And Flipper data' . PHP_EOL; echo '-- Report generated at ' . $date . PHP_EOL; foreach ($inserts as $insert) { echo $insert . PHP_EOL; }