public function run($action, $request=null) {
		$this->action = $action;
		$this->defaultView = $action;

		if($request === null)
			$request = new Request;
		$this->request = $request;
		$this->response = new Response;
		$this->response->setRequest($this->request);

		#before filters
		$result = null;
		foreach($this->beforeFilters as $filter) {
			if(($result = $filter($this, $request)) !== null)
				break;
		}

		if($result === null) {
			if(($result = $this->before($request)) === null)
				$result = $this->doRun($action, [$request]);
		}

		$this->after($request, $result);

		#after filters
		foreach($this->afterFilters as $filter)
			$filter($this, $request, $result);

		if($result instanceof Response)
			return $result;
		elseif(is_string($result))
			return $this->response->setContent($result);

		return $this->response;
	}
public function run($action, $request=null) {
		$this->action = $action;
		$this->defaultView = $action;

		if($request === null)
			$request = new Request;
		$this->request = $request;
		$this->response = new Response;
		$this->response->setRequest($this->request);

		#before filters
		$result = null;
		foreach($this->beforeFilters as $filter) {
			if(($result = $filter($this, $request)) !== null)
				break;
		}

		if($result === null) {
			if(($result = $this->before($request)) === null)
				$result = $this->doRun($action, [$request]);
		}

		$this->after($request, $result);

		#after filters
		foreach($this->afterFilters as $filter)
			$filter($this, $request, $result);

		if($result instanceof Response)
			return $result;
		elseif(is_string($result))
			return $this->response->setContent($result);

		return $this->response;
	}
public function run ( $ action , $ request = null ) { $ this -> action = $ action ; $ this -> defaultView = $ action ; if ( $ request === null ) $ request = new Request ; $ this -> request = $ request ; $ this -> response = new Response ; $ this -> response -> setRequest ( $ this -> request ) ; #before filters $ result = null ; foreach ( $ this -> beforeFilters as $ filter ) { if ( ( $ result = $ filter ( $ this , $ request ) ) !== null ) break ; } if ( $ result === null ) { if ( ( $ result = $ this -> before ( $ request ) ) === null ) $ result = $ this -> doRun ( $ action , [ $ request ] ) ; } $ this -> after ( $ request , $ result ) ; #after filters foreach ( $ this -> afterFilters as $ filter ) $ filter ( $ this , $ request , $ result ) ; if ( $ result instanceof Response ) return $ result ; elseif ( is_string ( $ result ) ) return $ this -> response -> setContent ( $ result ) ; return $ this -> response ; }
Run the action.
@param  string  $action
@param  Request $request
@return Response
Run the action .