/** * Get the user throttle information * If not found, makes a new one * * @param integer $userId User ID * @return ThrottleModel instance */ public static function getUserThrottle($userId) { $throttle = Gatekeeper::findThrottleByUserId($userId); if ($throttle === false) { $data = array('user_id' => $userId, 'attempts' => 1, 'status' => ThrottleModel::STATUS_ALLOWED, 'last_attempt' => date('Y-m-d H:i:s'), 'status_change' => date('Y-m-d H:i:s')); $throttle = Gatekeeper::modelFactory('ThrottleModel', $data); } return $throttle; }