PHP Class Slim\Views\PhpRenderer

Afficher le fichier Open project: geggleto/slim-renderer

Protected Properties

Свойство Type Description
$attributes array
$templatePath string

Méthodes publiques

Méthode Description
__construct ( string $templatePath = "", array $attributes = [] ) SlimRenderer constructor.
addAttribute ( $key, $value ) Add an attribute
fetch ( $template, array $data = [] ) : mixed Renders a template and returns the result as a string
getAttribute ( $key ) : mixed Retrieve an attribute
getAttributes ( ) : array Get the attributes for the renderer
getTemplatePath ( ) : string Get the template path
render ( Psr\Http\Message\ResponseInterface $response, string $template, array $data = [] ) : Psr\Http\Message\ResponseInterface Render a template
setAttributes ( array $attributes ) Set the attributes for the renderer
setTemplatePath ( string $templatePath ) Set the template path

Méthodes protégées

Méthode Description
protectedIncludeScope ( string $template, array $data )

Method Details

__construct() public méthode

SlimRenderer constructor.
public __construct ( string $templatePath = "", array $attributes = [] )
$templatePath string
$attributes array

addAttribute() public méthode

Add an attribute
public addAttribute ( $key, $value )
$key
$value

fetch() public méthode

cannot contain template as a key throws RuntimeException if $templatePath . $template does not exist
public fetch ( $template, array $data = [] ) : mixed
$template
$data array
Résultat mixed

getAttribute() public méthode

Retrieve an attribute
public getAttribute ( $key ) : mixed
$key
Résultat mixed

getAttributes() public méthode

Get the attributes for the renderer
public getAttributes ( ) : array
Résultat array

getTemplatePath() public méthode

Get the template path
public getTemplatePath ( ) : string
Résultat string

protectedIncludeScope() protected méthode

protected protectedIncludeScope ( string $template, array $data )
$template string
$data array

render() public méthode

$data cannot contain template as a key throws RuntimeException if $templatePath . $template does not exist
public render ( Psr\Http\Message\ResponseInterface $response, string $template, array $data = [] ) : Psr\Http\Message\ResponseInterface
$response Psr\Http\Message\ResponseInterface
$template string
$data array
Résultat Psr\Http\Message\ResponseInterface

setAttributes() public méthode

Set the attributes for the renderer
public setAttributes ( array $attributes )
$attributes array

setTemplatePath() public méthode

Set the template path
public setTemplatePath ( string $templatePath )
$templatePath string

Property Details

$attributes protected_oe property

protected array $attributes
Résultat array

$templatePath protected_oe property

protected string $templatePath
Résultat string