/** * Class constructor * * @param Mad_Controller_Request_Http $request */ public function __construct($request) { $this->_request = $request; $format = $this->_request->getFormat(); if (is_object($format) && $format instanceof Mad_Controller_Mime_Type) { $format = $format->__toString(); } $this->_format = $format; }
/** * Request is populated with all the superglobals from page request. */ public function __construct($options = array()) { $this->initData(); $this->setCookie(array()); $this->setSession(array()); $this->setFlash(array()); $this->setSessionId('1'); parent::__construct($options); }
/** * Log the http request * * @todo - get total query times * * @param Mad_Controller_Request_Http $request * @param int $totalTime */ protected function _logRequest($request, $totalTime) { $queryTime = 0; // total time to execute queries $queryCount = 0; // total queries performed $phpTime = $totalTime - $queryTime; // embed user info in log $uri = $request->getUri(); $method = $request->getMethod(); $paramStr = 'PARAMS=' . $this->_formatLogParams($request->getParameters()); $msg = sprintf("{$method} {$uri} %.4fs (DB=%.4fs [{$queryCount}] PHP=%.4fs) {$paramStr}", $totalTime, $queryTime, $phpTime); $msg = wordwrap($msg, 80, "\n\t ", 1); Mad_Controller_Dispatcher::logger()->info($msg); }
/** * Each variable set through routing {@link Mad_Controller_Route_Path} is * availabie in controllers using the $params array. * * The controller also has access to GET/POST arrays using $params * * The action method to be performed is stored in $this->params[':action'] key */ private function _initParams() { $hash = $this->_request->getParameters(); $this->params = new Mad_Support_ArrayObject($hash); $this->_action = $this->params->get(':action'); }