PHP Class Phlyty\View\MustacheViewModel

The main purpose of this class is to provide the view model with the App instance, thus giving it access to the various helper methods available in that class. Additionally, it provides an instance of Escaper, allowing you to do context-specific escaping within helpers you define in the view model.
Datei anzeigen Open project: phly/phlyty Class Usage Examples

Protected Properties

Property Type Description
$app Phlyty\App
$escaper Zend\Escaper\Escaper

Public Methods

Method Description
__app ( ) : App Retrieve application instance
__construct ( App $app, Zend\Escaper\Escaper $escaper = null ) Constructor
__escaper ( ) : Zend\Escaper\Escaper Retrieve escaper instance
bindHelper ( string $name, callable $helper ) : MustacheViewModel Bind a helper within the view model object's context

Method Details

__app() public method

Retrieve application instance
public __app ( ) : App
return Phlyty\App

__construct() public method

Receive and set the App instance as a protected property. If an Escaper instance is passed, it will be assigned; otherwise, an Escaper instance will be instantiated and assigned.
public __construct ( App $app, Zend\Escaper\Escaper $escaper = null )
$app Phlyty\App
$escaper Zend\Escaper\Escaper

__escaper() public method

Retrieve escaper instance
public __escaper ( ) : Zend\Escaper\Escaper
return Zend\Escaper\Escaper

bindHelper() public method

Allows using '$this' within the helper in order to access public properties and methods. Binds the helper to the public property given by $name.
public bindHelper ( string $name, callable $helper ) : MustacheViewModel
$name string
$helper callable
return MustacheViewModel

Property Details

$app protected_oe property

protected App,Phlyty $app
return Phlyty\App

$escaper protected_oe property

protected Escaper,Zend\Escaper $escaper
return Zend\Escaper\Escaper