Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
81.82% covered (warning)
81.82%
9 / 11
CRAP
85.00% covered (warning)
85.00%
17 / 20
FormView
0.00% covered (danger)
0.00%
0 / 1
81.82% covered (warning)
81.82%
9 / 11
15.76
85.00% covered (warning)
85.00%
17 / 20
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 isRendered
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
6 / 6
 setRendered
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 isMethodRendered
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setMethodRendered
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 offsetGet
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 offsetExists
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 offsetSet
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 offsetUnset
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getIterator
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 count
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * 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 <bschussek@gmail.com>
 */
class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
{
    /**
     * The variables assigned to this view.
     */
    public $vars = [
        'value' => null,
        'attr' => [],
    ];
    /**
     * The parent view.
     */
    public $parent;
    /**
     * The child views.
     *
     * @var FormView[]
     */
    public $children = [];
    /**
     * 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()
    {