PHP Class Bolt\Response\BoltResponse

Deprecation: Deprecated since 3.3, use TemplateResponse instead.
Author: Ross Riley ([email protected])
Inheritance: extends Symfony\Component\HttpFoundation\Response
Afficher le fichier Open project: bolt/bolt Class Usage Examples

Protected Properties

Свойство Type Description
$compiled
$context
$stopwatch Symfony\Component\Stopwatch\Stopwatch | null
$template Twig_Template

Méthodes publiques

Méthode Description
__construct ( Twig_Template $template, array $context = [], array $globals = [], integer $status = 200, array $headers = [] ) Constructor.
__toString ( ) : string Returns the Response as a string.
addGlobalContext ( string $name, mixed $value ) Adds a global to the template
addGlobals ( array $globals ) Adds globals to the template
compile ( ) Compiles the template using the context.
create ( Twig_Template $template = null, array $context = [], array $globals = [], integer $status = 200, array $headers = [] ) : BoltResponse Factory method for chainability
getContent ( ) : string Gets HTML content for the response.
getContext ( ) : array Returns the context.
getGlobalContext ( ) : array Gets globals from the template.
getTemplate ( ) : Twig_Template Returns the template.
getTemplateName ( ) : string Gets the name of the main loaded template.
isCompiled ( ) : boolean Returns whether the response has been compiled
setContext ( array $context ) Sets the context variables for this Response.
setStopwatch ( Symfony\Component\Stopwatch\Stopwatch $stopwatch )
setTemplate ( Twig_Template $template ) Sets the Renderer used to create this Response.

Private Methods

Méthode Description
handleException ( Exception $e ) : string The __toString method isn't allowed to throw exceptions so we turn them into an error instead

Method Details

__construct() public méthode

Constructor.
public __construct ( Twig_Template $template, array $context = [], array $globals = [], integer $status = 200, array $headers = [] )
$template Twig_Template An object that is able to render a template with context
$context array An array of context variables
$globals array An array of global context variables
$status integer The response status code
$headers array An array of response headers

__toString() public méthode

Returns the Response as a string.
public __toString ( ) : string
Résultat string The Response as HTML

addGlobalContext() public méthode

Adds a global to the template
public addGlobalContext ( string $name, mixed $value )
$name string
$value mixed

addGlobals() public méthode

Adds globals to the template
public addGlobals ( array $globals )
$globals array

compile() public méthode

Compiles the template using the context.
public compile ( )

create() public static méthode

Factory method for chainability
public static create ( Twig_Template $template = null, array $context = [], array $globals = [], integer $status = 200, array $headers = [] ) : BoltResponse
$template Twig_Template An object that is able to render a template with context
$context array An array of context variables
$globals array An array of global context variables
$status integer The response status code
$headers array An array of response headers
Résultat BoltResponse

getContent() public méthode

Gets HTML content for the response.
public getContent ( ) : string
Résultat string

getContext() public méthode

Returns the context.
public getContext ( ) : array
Résultat array

getGlobalContext() public méthode

Gets globals from the template.
public getGlobalContext ( ) : array
Résultat array

getTemplate() public méthode

Returns the template.
public getTemplate ( ) : Twig_Template
Résultat Twig_Template

getTemplateName() public méthode

Gets the name of the main loaded template.
public getTemplateName ( ) : string
Résultat string

isCompiled() public méthode

Returns whether the response has been compiled
public isCompiled ( ) : boolean
Résultat boolean

setContext() public méthode

Sets the context variables for this Response.
public setContext ( array $context )
$context array

setStopwatch() public méthode

public setStopwatch ( Symfony\Component\Stopwatch\Stopwatch $stopwatch )
$stopwatch Symfony\Component\Stopwatch\Stopwatch

setTemplate() public méthode

Sets the Renderer used to create this Response.
public setTemplate ( Twig_Template $template )
$template Twig_Template A template object

Property Details

$compiled protected_oe property

protected $compiled

$context protected_oe property

protected $context

$stopwatch protected_oe property

protected Stopwatch,Symfony\Component\Stopwatch|null $stopwatch
Résultat Symfony\Component\Stopwatch\Stopwatch | null

$template protected_oe property

protected Twig_Template $template
Résultat Twig_Template