PHP Класс Bolt\Response\BoltResponse

Устаревший: Deprecated since 3.3, use TemplateResponse instead.
Автор: Ross Riley ([email protected])
Наследование: extends Symfony\Component\HttpFoundation\Response
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$compiled
$context
$stopwatch Symfony\Component\Stopwatch\Stopwatch | null
$template Twig_Template

Открытые методы

Метод Описание
__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.

Приватные методы

Метод Описание
handleException ( Exception $e ) : string The __toString method isn't allowed to throw exceptions so we turn them into an error instead

Описание методов

__construct() публичный Метод

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() публичный Метод

Returns the Response as a string.
public __toString ( ) : string
Результат string The Response as HTML

addGlobalContext() публичный Метод

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

addGlobals() публичный Метод

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

compile() публичный Метод

Compiles the template using the context.
public compile ( )

create() публичный статический Метод

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
Результат BoltResponse

getContent() публичный Метод

Gets HTML content for the response.
public getContent ( ) : string
Результат string

getContext() публичный Метод

Returns the context.
public getContext ( ) : array
Результат array

getGlobalContext() публичный Метод

Gets globals from the template.
public getGlobalContext ( ) : array
Результат array

getTemplate() публичный Метод

Returns the template.
public getTemplate ( ) : Twig_Template
Результат Twig_Template

getTemplateName() публичный Метод

Gets the name of the main loaded template.
public getTemplateName ( ) : string
Результат string

isCompiled() публичный Метод

Returns whether the response has been compiled
public isCompiled ( ) : boolean
Результат boolean

setContext() публичный Метод

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

setStopwatch() публичный Метод

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

setTemplate() публичный Метод

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

Описание свойств

$compiled защищенное свойство

protected $compiled

$context защищенное свойство

protected $context

$stopwatch защищенное свойство

protected Stopwatch,Symfony\Component\Stopwatch|null $stopwatch
Результат Symfony\Component\Stopwatch\Stopwatch | null

$template защищенное свойство

protected Twig_Template $template
Результат Twig_Template