public function call(Request $req = null, Error $err = null) { if (!$this->config['viewPath']) { throw new Error('Missing the `viewPath` parameter'); } if (!file_exists($this->config['viewPath'])) { throw new Error('The view path does not exist: ' . $this->config['viewPath']); } return $this->render(parent::call($req, $err)); }
public function call(Request $req = null, Error $err = null) { if (!$req) { $req = $this->getCurrentRequest(); } $this->d('Stack.call(`' . $req->method . ' ' . $req->uri . '`)'); switch ($this->state) { case static::STATE_IDLE: if ($app = $this->resolve($req)) { return $app->call($req, $err); } return parent::call($req, $err); case static::STATE_LOOP: return $this->next ? $this->next->call($req, $err) : new Response($req); default: return parent::call($req, $err); } }
public function testNestedHandleRequest() { $layer = new Layer(new Layer()); $res = $layer->call(new Request('GET', '/test')); $this->assertInstanceOf('Server\\Response', $res); }