\Charcoal\App\HandlerAbstractHandler

Base Error Handler

Enhanced version Slim's error handlers.

It outputs messages in either JSON, XML or HTML based on the Accept header.

Summary

Methods
Properties
Constants
__construct()
init()
setDependencies()
setContainer()
createConfig()
messageTitle()
renderHtmlMessage()
setBaseUrl()
baseUrl()
No public properties found
No constants found
determineContentType()
renderHtmlOutput()
renderHtmlTemplate()
$container
$baseUrl
$knownContentTypes
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

__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.

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