/** * method used to return the current event object * will instantiate the event object if it doesn't already exist * * @access public * @static * @return System_Event_Controller */ public static function getEventObj() { if (!self::$_event_obj) { self::$_event_obj = new System_Event_Controller(); } return self::$_event_obj; }
/** * sets the request event object if it isn't set and also sets the event_obj property * this method should be called in all of the system events to ensure that the event object exists * * @access private * @return System_Request_Command_Abstract */ private function getRequestEvent() { if (!$this->_request_event_obj) { $this->_request_event_obj = System_Request_Command_Event::getInstance(); $this->_event_obj = $this->_request_event_obj->getEventObj(); } return $this; }
/** * determines which command to return * TODO: come up with a way to all for all response types to be represented in the System_Request_Command_Generic call * * @access private * @return string that represents a System_Request_Command_Abstract */ private function getCommand() { $use_404 = false; $use_401 = false; if ($this->validateRequest()) { if (!isset($this->_data['command']) || !class_exists($this->_data['command'])) { $use_404 = true; } } else { $use_401 = true; } if ($use_401 || $use_404) { $event = $use_404 ? 404 : 401; $request_event = System_Request_Command_Event::getInstance(); $this->_command_data['event'] = $event; $command = 'System_Request_Command_Generic'; } else { $command = $this->_data['command']; } return $command; }