private function makeJSONResponse() : array { if (!is_array($this->json)) { throw new \Exception(sprintf('Instance of ResponseBuilder has no JSON response')); } return $this->decorators->decorate($this, $this->json); }
protected function initDecorators(ResponseDecoratorsManager $decoratorsManager) { $decoratorsManager->attach(new SuccessResponseDecorator())->attach(new TimeResponseDecorator())->attach(new ErrorResponseDecorator()); }