@param string $name

@return Component

@throws \RuntimeException
769440
public function getComponent(string $name) : Component
    {
        if (isset($this->components[$name])) {
            return $this->components[$name];
        }

        throw new \RuntimeException(sprintf('No component named "%s"', $name));
    }
385069
protected function createRuntimeDriver($name)
    {
        $config = Arr::get($this->config, "runtime.{$name}", []);
        return $this->createProvider(new Runtime($name, $config));
    }
156493
public function getTypeByName($name)
    {
        foreach ($this->collection as $type) {
            /** @var $type TypeInterface */
            if ($type->getName() === $name) {
                return $type;
            }
        }

        throw new \RuntimeException(\sprintf('No type found for name %s, list: %s', \var_export($name, true), \var_export($this->collection, true)));
    }
406539
private function loadMenu($name)
    {
        if ($name instanceof Menu) {
            return $name;
        }

        $menu = $this->menuRepository->findOneBy(array('name' => $name));

        if (!$menu) {
            throw new \RuntimeException(sprintf('Unable to load menu "%s"', $name));
        }

        return $menu;
    }
390731
protected function getResourceType($name)
    {
        if (!isset($this->types[$name])) {
            $template = $this->parser->parse($name);
            if ($template instanceof TemplateReferenceInterface) {
                $this->types[$name] = $template->get('engine');
            }
        }
        if (!isset($this->types[$name])) {
            throw new \RuntimeException("Could not load the given resource.");
        }

        return $this->types[$name];
    }
1120483
public function target($name)
    {
        if (!$this->config->hasTarget($name)) {
            throw new RuntimeException("The target named '$name' does not exist.");
        }
        $ext = $this->config->getExt($name);

        $themed = $this->config->isThemed($name);
        $filters = $this->config->targetFilters($name);
        $target = $this->config->cachePath($ext) . $name;

        $files = [];
        $scanner = $this->scanner($this->config->paths($ext, $name));
        $paths = $scanner->paths();

        $required = $this->config->requires($name);
        if ($required) {
            $compiler = $this->cachedCompiler();
            foreach ($required as $dependency) {
                $files[] = new Target($this->target($dependency), $compiler);
            }
        }

        foreach ($this->config->files($name) as $file) {
            if (preg_match('#^https?://#', $file)) {
                $files[] = new Remote($file);
            } else {
                if (preg_match('/(.*\/)(\*.*?)$/U', $file, $matches)) {
                    $path = $scanner->find($matches[1]);
                    if ($path === false) {
                        throw new RuntimeException("Could not locate folder $file for $name in any configured path.");
                    }
                    $glob = new Glob($path, $matches[2]);
                    $files = array_merge($files, $glob->files());
                } elseif (preg_match(static::CALLBACK_PATTERN, $file, $matches)) {
                    $callback = new Callback($matches[1], $matches[2], $scanner);
                    $files = array_merge($files, $callback->files());
                } else {
                    $path = $scanner->find($file);
                    if ($path === false) {
                        throw new RuntimeException("Could not locate $file for $name in any configured path.");
                    }
                    $files[] = new Local($path);
                }
            }
        }
        return new AssetTarget($target, $files, $filters, $paths, $themed);
    }
1135310
public function getModuleByName($name)
    {
        $modules = $this->getModuleRepository();
        if ($modules->has($name) === false) {
            throw new RuntimeException("Module [$name] does not exists.");
        }

        return $modules->find($name);
    }
421938
protected function getManager($name)
    {
        $id = $this->getManagerId($name);

        if ($this->getContainer()->has($id)) {
            return $this->getContainer()->get($id);
        }

        throw new \RuntimeException(
            sprintf(
                'Manager named `%s` not found. Available: `%s`.',
                $name,
                implode('`, `', array_keys($this->getContainer()->getParameter('es.managers')))
            )
        );
    }
1142825
protected function getComponent($name)
    {
        $formatter = $this->cache->rememberForever('flarum.formatter', function () {
            return $this->getConfigurator()->finalize();
        });

        return $formatter[$name];
    }
137
protected function createComponent($name): ?IComponent
    {
        $method = 'createComponent'.ucfirst($name);
        if (method_exists($this, $method)) {
            $this->checkRequirements(self::getReflection()->getMethod($method));
        }

        return parent::createComponent($name);
    }
1265128
public function getComponent($name)
    {
        if (isset($name) && isset($this->_oaComponents[$name])) {
            return $this->_oaComponents[$name];
        }
    }
170600
public function create($name)
    {
        $config = $this->getConfiguration($name);

        if(null === $config) {
            throw new \RuntimeException(
                "Connection with name: $name not found."
            );
        }

        return new Client($config);
    }
448007
public function get($name)
    {
        $item = $this->getFactory($name)->get();

        if ($item instanceof ContainerAwareInterface) {
            $item->setContainer($this);
        }

        return $item;
    }
852098
public function find($name)
    {
        foreach ($this->all() as $component) {
            if ($component->getLowerName() === strtolower($name)) {
                return $component;
            }
        }

        return;
    }
804815
public function getDataSource($name)
    {
        if (false === $this->hasDataSource($name)) {
            throw new \RuntimeException(sprintf('Data source: "%s" not found.', $name));
        }

        return $this->dataSources[$name];
    }
268440
public function getFilter($name)
    {
        if (!array_key_exists($name, $this->filters)) {
            throw new \RuntimeException('There is no filter for the name "' . $name . '" registered.');
        }

        return $this->filters[$name];
    }
1305273
public function build($name)
    {
        if (!isset($this->state_machine_definitions[$name])) {
            throw new RuntimeError('State machine not configured: ' . $name);
        }

        // name is necessary as option here, as there may be multiple state machines in the definition xml file
        $builder = new XmlStateMachineBuilder(
            [
                'name' => $name,
                'state_machine_definition' => $this->state_machine_definitions
            ],
            $this->service_locator
        );

        return $builder->build();
    }