3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\View\Model
;
13 use IteratorAggregate
;
16 * Interface describing a view model.
18 * Extends "Countable"; count() should return the number of children attached
21 * Extends "IteratorAggregate"; should allow iterating over children.
23 interface ModelInterface
extends Countable
, IteratorAggregate
26 * Set renderer option/hint
30 * @return ModelInterface
32 public function setOption($name, $value);
35 * Set renderer options/hints en masse
37 * @param array|\Traversable $options
38 * @return ModelInterface
40 public function setOptions($options);
43 * Get renderer options/hints
45 * @return array|\Traversable
47 public function getOptions();
50 * Get a single view variable
53 * @param mixed|null $default (optional) default value if the variable is not present.
56 public function getVariable($name, $default = null);
63 * @return ModelInterface
65 public function setVariable($name, $value);
68 * Set view variables en masse
70 * @param array|\ArrayAccess $variables
71 * @return ModelInterface
73 public function setVariables($variables);
78 * @return array|\ArrayAccess
80 public function getVariables();
83 * Set the template to be used by this model
85 * @param string $template
86 * @return ModelInterface
88 public function setTemplate($template);
91 * Get the template to be used by this model
95 public function getTemplate();
100 * @param ModelInterface $child
101 * @param null|string $captureTo Optional; if specified, the "capture to" value to set on the child
102 * @param null|bool $append Optional; if specified, append to child with the same capture
103 * @return ModelInterface
105 public function addChild(ModelInterface
$child, $captureTo = null, $append = false);
108 * Return all children.
110 * Return specifies an array, but may be any iterable object.
114 public function getChildren();
117 * Does the model have any children?
121 public function hasChildren();
124 * Set the name of the variable to capture this model to, if it is a child model
126 * @param string $capture
127 * @return ModelInterface
129 public function setCaptureTo($capture);
132 * Get the name of the variable to which to capture this model
136 public function captureTo();
139 * Set flag indicating whether or not this is considered a terminal or standalone model
141 * @param bool $terminate
142 * @return ModelInterface
144 public function setTerminal($terminate);
147 * Is this considered a terminal or standalone model?
151 public function terminate();
155 * Set flag indicating whether or not append to child with the same capture
157 * @param bool $append
158 * @return ModelInterface
160 public function setAppend($append);
163 * Is this append to child with the same capture?
167 public function isAppend();