public static function initStatsResult(KurogoStatsOption $OptionObject) { $result = array(); foreach ($OptionObject->getGroup() as $group) { switch ($group) { case 'moduleID': if ($OptionObject->getService() == 'web') { $moduleData = WebModule::getAllModules(); } else { $moduleData = APIModule::getAllModules(); } $result = array_combine(array_keys($moduleData), array_fill(0, count($moduleData), 0)); break; case 'platform': $platforms = self::$platforms; $result = array_combine(array_keys($platforms), array_fill(0, count($platforms), 0)); break; case 'pagetype': $pagetypes = self::$pagetypes; $result = array_combine(array_keys($pagetypes), array_fill(0, count($pagetypes), 0)); break; case 'hour': $result = array_combine(range(0, 23), array_fill(0, 24, 0)); break; } } return $result; }
public static function isValidModuleID($service, $moduleID) { static $allModuleData = array('web' => array(), 'api' => array()); $moduleData = array(); if (isset($allModuleData[$service]) && !empty($allModuleData[$service])) { $moduleData = $allModuleData[$service]; } if (!$moduleData) { if ($service == 'web') { $allModuleData['web'] = WebModule::getAllModules(); $moduleData = $allModuleData['web']; } else { $allModuleData['api'] = APIModule::getAllModules(); $moduleData = $allModuleData['api']; } } return isset($moduleData[$moduleID]) ? true : false; }