Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
54.55% covered (warning)
54.55%
6 / 11
CRAP
82.50% covered (warning)
82.50%
33 / 40
AbstractExtension
0.00% covered (danger)
0.00%
0 / 1
54.55% covered (warning)
54.55%
6 / 11
29.62
82.50% covered (warning)
82.50%
33 / 40
 getType
0.00% covered (danger)
0.00%
0 / 1
3.07
80.00% covered (warning)
80.00%
4 / 5
 hasType
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 getTypeExtensions
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
5 / 5
 hasTypeExtensions
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 3
 getTypeGuesser
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 loadTypes
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 loadTypeExtensions
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 loadTypeGuesser
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 initTypes
0.00% covered (danger)
0.00%
0 / 1
3.04
83.33% covered (warning)
83.33%
5 / 6
 initTypeExtensions
0.00% covered (danger)
0.00%
0 / 1
4.05
85.71% covered (warning)
85.71%
6 / 7
 initTypeGuesser
0.00% covered (danger)
0.00%
0 / 1
3.07
80.00% covered (warning)
80.00%
4 / 5
<?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\InvalidArgumentException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
abstract class AbstractExtension implements FormExtensionInterface
{
    /**
     * The types provided by this extension.
     *
     * @var FormTypeInterface[] An array of FormTypeInterface
     */
    private $types;
    /**
     * The type extensions provided by this extension.
     *
     * @var FormTypeExtensionInterface[] An array of FormTypeExtensionInterface
     */
    private $typeExtensions;
    /**
     * The type guesser provided by this extension.
     *
     * @var FormTypeGuesserInterface|null
     */
    private $typeGuesser;
    /**
     * Whether the type guesser has been loaded.
     *
     * @var bool
     */
    private $typeGuesserLoaded = false;
    /**
     * {@inheritdoc}
     */
    public function getType(string $name)
    {
        if (null === $this->types) {
            $this->initTypes();
        }
        if (!isset($this->types[$name])) {
            throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension.', $name));
        }