* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\BadMethodCallException; /** * @author Bernhard Schussek */ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable { /** * The variables assigned to this view. */ public $vars = array( 'value' => null, 'attr' => array(), ); /** * The parent view. */ public $parent; /** * The child views. * * @var FormView[] */ public $children = array(); /** * Is the form attached to this renderer rendered? * * Rendering happens when either the widget or the row method was called. * Row implicitly includes widget, however certain rendering mechanisms * have to skip widget rendering when a row is rendered. * * @var bool */ private $rendered = false; private $methodRendered = false; public function __construct(self $parent = null) { $this->parent = $parent; } /** * Returns whether the view was already rendered. * * @return bool Whether this view's widget is rendered */ public function isRendered() { if (true === $this->rendered || 0 === count($this->children)) { return $this->rendered; } foreach ($this->children as $child) { if (!$child->isRendered()) { return false; } } return $this->rendered = true; } /** * Marks the view as rendered. * * @return $this */ public function setRendered() { $this->rendered = true; return $this; } /** * @return bool */ public function isMethodRendered() { return $this->methodRendered; } public function setMethodRendered() { $this->methodRendered = true; } /** * Returns a child by name (implements \ArrayAccess). * * @param string $name The child name * * @return self The child view */ public function offsetGet($name) { return $this->children[$name]; } /** * Returns whether the given child exists (implements \ArrayAccess). * * @param string $name The child name * * @return bool Whether the child view exists */ public function offsetExists($name) { return isset($this->children[$name]); } /** * Implements \ArrayAccess. * * @throws BadMethodCallException always as setting a child by name is not allowed */ public function offsetSet($name, $value) { throw new BadMethodCallException('Not supported'); } /** * Removes a child (implements \ArrayAccess). * * @param string $name The child name */ public function offsetUnset($name) { unset($this->children[$name]); } /** * Returns an iterator to iterate over children (implements \IteratorAggregate). * * @return \ArrayIterator|FormView[] The iterator */ public function getIterator() { return new \ArrayIterator($this->children); } /** * Implements \Countable. * * @return int The number of children views */ public function count() { return count($this->children); } } __halt_compiler();----SIGNATURE:----ZQa5XuFeJjCQVMkVB9a7gue9+bKwDx9aWPZxzR8CeE+bFpnATNpmAoID6PWLeXjt/Eqqt6eLOPUzdv5mTIFRBn8Gq6hUD7BI2wxgeP+x91t/21PjTVGeriWh0HfK8jgYUdY/TS1A3jZ3Xm/pYB4jseqNsKmAqmOe2P8pzyWv84F87CBXwib2lZZTgI1PK4D+7UHl7fWpd80Eg4+yh5gBfHG2DHui5dSh96inER+ix/9QJYF+qBqstQc0m1HZtHbHaKh71l2wTniYpXM16pLNpmNIWFU5zaiH42EpyAsep6v+SwQXuyeXSLnrtAmKr5c/P370KD/sd5U4b6dAuG63nM/K4R3EPwWBU2LoaF7o9MpjhfF1HR53YxZc2a1cwpO2St+I6i7I7gJ/SIJKeyR4LS5EuVmu1yr4SRbInojd8V7FYeOLYtaKBAk2mt+s5gufCGbFYX6LWuAN0JZhEU8j7aFEpW01Akvd1DMNItf9bDL+jw70y0vgz+562+DEzJzRcSQOebhWTDh5EbxgWvZiSZMIjbpoY3d7rMyp69ji+ssVAoTHNzye2/OYY+Fuc+vgQODLwU7HLNNhVyqjb93uXjkx0Hug2ii/3OesIaNHZcB+LTh8pUwTKFt6nR8Xuetoj382uuemoauHndhfz+PBMfPEUXkX06YfZRWNBipOVUk=----ATTACHMENT:----MzcyMTE3NDE1MjQ2MDI1IDM3NTA2ODQ5OTY4OTM5MzMgODA4MzQ0ODg3NzkwNjYxNA==