$internalViewData : array
The data assigned to this view. Usually, a controller will be responsible for passing data to the view object using the assign() method.
A simple view implementation that allows for simple assignment of data, escaping for common contexts (e.g. HTML, HTML attribute, JS, etc.), and calling of helper objects for reusable view logic.
Including method annotations here (http://www.phpdoc.org/docs/latest/references/phpdoc/tags/method.html) to assist static analysis in PHPStorm and Scrutinizer CI given the use of the __call() magic method in this class for view helpers. Won't cover us on custom helpers necessarily, but it will help catch most bugs/typos.
$request : \Dewdrop\Request
The current HTTP request.
__construct(\Zend\Escaper\Escaper $escaper = null, \Dewdrop\Request $request = null)
Create a new view, optionally supplying an escaper object for use in sanitizing output in various contexts.
assign(string|array $name, mixed $value = null) : \Dewdrop\View\View
Assign variables to this view's data.
If the $name parameter is an array rather than a string, assign() will iterate over it, assigning variables for each key-value pair. For example, passing the following array would assign 3 different data variables:
$this->assign( array( 'var1' => 1, 'var1' => 2, 'var1' => 3 ) );
assignInstance(string $name, object $instance) : $this
Assign a helper instance to the supplied name, rather than requiring that it be instantiated when the helper is accessed. Typically used to share helper instances with partials generated by a parent view, which reduces resource usage and allows things like CSS and JS added by partials to propagate intuitively.
registerHelper(string $name, string $className) : \Dewdrop\View\View
Register a new helper name and class name. This can be used to replace a default helper implementation or to introduce a project-specific helper.
The full class name/namespace.
__get(string $name) : mixed
Retrieve the named index from the $data property or return null. This makes it easier to avoid undefined variable notices in your view scripts because you don't have to be quite so circumspect in ensuring variables are set before checking them.
__set(string $name, mixed $value) : \Dewdrop\View\View
Delegate assignment to unknown class properties to the assign() method.
__call(string $method, array $args) : \Dewdrop\View\Helper\AbstractHelper
When calling an unknown method on this view, pass the method name to the helper() method and call the helper's direct() method. Using the __call() magic method in this way allows using helpers in this manner:
Rather than having to call an additional method on the helper like this:
If the direct() method is unavailable, the helper instance is returned instead.
helper(string $name) : \Dewdrop\View\Helper\AbstractHelper
Get the helper matching the provided named.
partial(string $template, array $data, string $scriptPath = null) : string
Render a partial view. By default, the same script path used by this view is passed along. This escaper from this view is also passed to the partial.
getRequest() : \Dewdrop\Request
Get the current Request object for access to GET or POST data from helpers.
setScriptPath(string $path) : \Dewdrop\View\View
Set the path in which to look for view scripts.
render(string $template) : string
Render the provided template file.
The file's name should end in .phtml and be present in the assigned script path. This method returns the output as a string so that you have the opportunity to filter or otherwise handle it prior to actually adding it to the response.
instantiateHelper(string $name) : \Dewdrop\View\Helper\AbstractHelper
Create an instance of helper associated with the provided name and store that instance in the $helpers property so that it can be retrieved on any subsequent calls.
castEscaperStringValue(mixed $input) : string
\Zend\Escaper\Escaper does not play well with falsey non-string values like null or false. It throws exceptions claiming it cannot convert them to utf-8. This method will convert false and null to an empty string and then cast the return value to a string (which should catch ints and floats as well).