Nette\ComponentModel\Container::createComponent PHP Method

createComponent() protected method

Component factory. Delegates the creation of components to a createComponent method.
protected createComponent ( $name ) : Nette\ComponentModel\IComponent
return Nette\ComponentModel\IComponent the created component (optionally)
    protected function createComponent($name)
    {
        $ucname = ucfirst($name);
        $method = 'createComponent' . $ucname;
        if ($ucname !== $name && method_exists($this, $method) && (new \ReflectionMethod($this, $method))->getName() === $method) {
            $component = $this->{$method}($name);
            if (!$component instanceof IComponent && !isset($this->components[$name])) {
                $class = get_class($this);
                throw new Nette\UnexpectedValueException("Method {$class}::{$method}() did not return or create the desired component.");
            }
            return $component;
        }
    }