\Charcoal\App\HandlerShutdown

Shutdown Handler

It outputs a simple message in either JSON, XML, or HTML based on the Accept header.

A maintenance mode check is included in the default middleware stack for your application. This is a practical feature to "disable" your application while performing an update or maintenance.

Summary

Methods
Properties
Constants
__construct()
init()
setDependencies()
setContainer()
createConfig()
messageTitle()
renderHtmlMessage()
setBaseUrl()
baseUrl()
__invoke()
methods()
No public properties found
No constants found
determineContentType()
renderHtmlOutput()
renderHtmlTemplate()
setMethods()
renderPlainOutput()
renderJsonOutput()
renderXmlOutput()
$container
$baseUrl
$knownContentTypes
$methods
N/A
No private methods found
No private properties found
N/A

Properties

$container

$container : \Pimple\Container

Container

Type

\Pimple\Container

$baseUrl

$baseUrl : string

URL for the home page

Type

string

$knownContentTypes

$knownContentTypes : array

Known handled content types

Type

array

$methods

$methods : string

HTTP methods allowed by the current request.

Type

string

Methods

__construct()

__construct(\Pimple\Container  $container) 

Return a new AbstractHandler object.

Parameters

\Pimple\Container $container

A dependencies container instance.

setDependencies()

setDependencies(\Pimple\Container  $container) : \Charcoal\App\Handler\AbstractHandler

Inject dependencies from a Pimple Container.

Dependencies

  • AppConfig $appConfig — The application's configuration.
  • UriInterface $baseUri — A base URI.
  • ViewInterface $view — A view instance.

Parameters

\Pimple\Container $container

A dependencies container instance.

Returns

\Charcoal\App\Handler\AbstractHandler

Chainable

setContainer()

setContainer(\Pimple\Container  $container) : \Charcoal\App\Handler\AbstractHandler

Set container for use with the template controller

Parameters

\Pimple\Container $container

A dependencies container instance.

Returns

\Charcoal\App\Handler\AbstractHandler

Chainable

createConfig()

createConfig(mixed|null  $data = null) : \Charcoal\App\Handler\ConfigInterface

ConfigurableTrait > createConfig()

Parameters

mixed|null $data

Optional config data.

Returns

\Charcoal\App\Handler\ConfigInterface

messageTitle()

messageTitle() : string

Render title of error

Returns

string

renderHtmlMessage()

renderHtmlMessage() : string

Render body of HTML error

Returns

string

setBaseUrl()

setBaseUrl(string|\Psr\Http\Message\UriInterface  $url) : \Charcoal\App\Handler\AbstractHandler

Set the base URL (home page).

Parameters

string|\Psr\Http\Message\UriInterface $url

A URL to the base URL.

Returns

\Charcoal\App\Handler\AbstractHandler

Chainable

baseUrl()

baseUrl() : string

Retrieves the URL for the home page.

Returns

string —

A URL representing the home page.

__invoke()

__invoke(\Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, array<mixed,string>  $methods) : \Psr\Http\Message\ResponseInterface

Invoke "Maintenance" Handler

Parameters

\Psr\Http\Message\ServerRequestInterface $request

The most recent Request object.

\Psr\Http\Message\ResponseInterface $response

The most recent Response object.

array<mixed,string> $methods

Allowed HTTP methods.

Returns

\Psr\Http\Message\ResponseInterface

methods()

methods() : string

Retrieves the HTTP methods allowed by the current request.

Returns

string —

Returns the allowed request methods.

determineContentType()

determineContentType(\Psr\Http\Message\ServerRequestInterface  $request) : string

Determine which content type we know about is wanted using "Accept" header

Parameters

\Psr\Http\Message\ServerRequestInterface $request

The most recent Request object.

Returns

string

renderHtmlOutput()

renderHtmlOutput() : string

Render HTML Error Page

Returns

string

renderHtmlTemplate()

renderHtmlTemplate() : string

Render HTML Error Page

Returns

string

setMethods()

setMethods(array  $methods) : \Charcoal\App\Handler\Shutdown

Set the HTTP methods allowed by the current request.

Parameters

array $methods

Case-sensitive array of methods.

Returns

\Charcoal\App\Handler\Shutdown

Chainable

renderPlainOutput()

renderPlainOutput() : string

Render Plain/Text Error

Returns

string

renderJsonOutput()

renderJsonOutput() : string

Render JSON Error

Returns

string

renderXmlOutput()

renderXmlOutput() : string

Render XML Error

Returns

string