ResponseFactory
class ResponseFactory implements ResponseFactoryInterface, ApplicationAwareInterface (View source)
Traits
Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface
Properties
protected Application | $app | from ApplicationAwareTrait | |
protected Request | $request | ||
private Localization | $localization | ||
private Repository | $config |
Methods
Create a response
Create a response
Create a page not found response
Create an error response
Create a forbidden response
Create a redirect response
Create a response from a controller object
Create a response from a collection object
Details
setApplication(Application $app)
Setter method for the application
__construct(Request $request, Localization $localization, Repository $config)
No description
Response
create(string $content, int $code = Response::HTTP_OK, array $headers = [])
Create a response
Response
json(array|object|JsonSerializable $data, int $code = Response::HTTP_OK, array $headers = [])
Create a response
Response
notFound(string $content, int $code = Response::HTTP_NOT_FOUND, array $headers = [])
Create a page not found response
Response
error(string $content, int $code = Response::HTTP_INTERNAL_SERVER_ERROR, array $headers = [])
Create an error response
Response
forbidden(string $requestUrl, int $code = Response::HTTP_FORBIDDEN, array $headers = [])
Create a forbidden response
Response
redirect(string $to, int $code = Response::HTTP_MOVED_PERMANENTLY, array $headers = [])
Create a redirect response
Response
view(View $view, int $code = Response::HTTP_OK, array $headers = [])
Create a response from a view object
Response
controller(Controller $controller, int $code = Response::HTTP_OK, array $headers = [])
Create a response from a controller object
Response
collection(Collection $collection, int $code = Response::HTTP_OK, array $headers = [])
Create a response from a collection object
private
collectionNotFound(Collection $collection, Request $request, array $headers)
No description