Obtain a controller helper by its key name.

@param string $helperName

@throws \InvalidArgumentException

@return mixed
511517
protected function helper($helperName)
    {
        if (!isset($this->helpers[$helperName])) {
            throw new \InvalidArgumentException('Unable to locate controller helper: ' . $helperName);
        }

        return $this->helpers[$helperName];
    }
504150
public function hasName($helperType)
    {
        if ($this->isValidKey($helperType)) {
            if ($this->getHelperMap()->hasKey($helperType)) {
                return true;
            }
        } else {
            throw new InvalidArgumentException('Invalid form helper type given');
        }
        return false;
    }
1012208
public function get($name)
    {
        if (!$this->has($name)) {
            throw new \InvalidArgumentException(sprintf('The field guesser "%s" does not exist.', $name));
        }

        return $this->fieldGuessers[$name];
    }
862741
public function getManager($name = null)
    {
        $name = $name ?: $this->getDefaultManagerName();

        if (!$this->managerExists($name)) {
            throw new InvalidArgumentException(sprintf('Doctrine Manager named "%s" does not exist.', $name));
        }

        if (isset($this->managersMap[$name])) {
            return $this->managersMap[$name];
        }

        return $this->managersMap[$name] = $this->getService(
            $this->getManagerBindingName($this->managers[$name])
        );
    }
867274
protected function _getCommands($controllerName)
    {
        $commands = [];

        foreach (get_class_methods($controllerName) as $method) {
            if (preg_match('#^(.*)Command$#', $method, $match) === 1 && $match[1] !== 'help') {
                $commands[] = $match[1];
            }
        }

        return $commands;
    }
824750
public static function getViewHelper($appName = null, bool $layout = false)
    {
        if ($appName === false) {
            $class = '\Osf\View\Helper';
            $instance = 'osf';
        } else {
            $appName = $appName === null ? Router::getDefaultControllerName(true) : $appName;
            $class = "\\App\\" . $appName . '\View\Helper';
            $instance = $appName;
        }
        $viewName = $layout ? 'layout' : 'view';
        $instance .= $layout ? '_l' : '_v';
        return self::buildObject($class, [$viewName]); //, $instance);
    }
887050
public function getHelper()
	{
		$config = $this->asConfig();
		if (isset($config))
		{
			$config = ConfigHelper::filterConfig($config, 'PHP');
		}
		else
		{
			// Use a dummy config with a regexp that doesn't match anything
			$config = [
				'attrName' => $this->attrName,
				'regexp'   => '/(?!)/',
				'tagName'  => $this->tagName
			];
		}

		return new Helper($config);
	}
140331
public function getHelper($name) {
        if ( !$this->helperExist($name) ) {
            throw new \Exception(sprintf('El Helper (%s) solicitado no fue cargado.', $name));
        }
        $helper = $this->_container[$name];
        $helper->configure([]);
        return $helper;
    }
374303
public function getHelper($name)
    {
        if (empty($this->helpers[$name])) {
            $class = $this->findHelper($name);

            if ($class === false) {
                throw new \DomainException(sprintf('Helper: %s not found.', $name));
            }

            $this->helpers[$name] = new $class($this);
        }

        return $this->helpers[$name];
    }
762089
protected function _getRegisterHelper() {
        $registerHelper = $this->_helper->getHelper('Register');
        if (!$registerHelper) {
            return null;
        }
        if (!$registerHelper instanceof Garp_Controller_Helper_Register) {
            throw new Garp_Auth_Exception(self::EXCEPTION_INVALID_REGISTER_HELPER);
        }
        return $registerHelper;
    }
1199839
public function get($name) {
        if (!isset($this->commands[$name])) {
            throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name));
        }

        return $this->commands[$name];

        //if ($this->wantHelps) {
        //    $this->wantHelps = false;

            /** @var HelpCommand $helpCommand */
        //    $helpCommand = $this->get('help');
        //    $helpCommand->setCommand($command);

        //    return $helpCommand;
        //}

        //return $command;
    }
1080820
public function getNameInput()
    {
        $name = Helpers::upperCaseEveyWord(trim($this->argument('controller-name')));
        $path = Config::getControllersPath();
        $directory = trim($this->option('controller-directory'));

        if (!empty($directory)) {
            $path .= Helpers::getPathWithSlash($directory);
        }

        return Helpers::convertSlashToBackslash($path . Helpers::postFixWith($name, Config::getControllerNamePostFix()));
    }
387786
protected function _fieldName(FormHelper $helper, $name)
    {
        $prefix = $helper->prefix();
        if (!empty($prefix) && strpos($name, $prefix) !== 0) {
            $name = "{$prefix}{$name}";
        }

        return $name;
    }
218237
public function getManager(?string $name = null) : ObjectManager
    {
        if ($name === null) {
            $name = $this->defaultManager;
        }

        if (! isset($this->managers[$name])) {
            throw new InvalidArgumentException(
                sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)
            );
        }

        /** @var ObjectManager $objectManager */
        $objectManager = $this->getService($this->managers[$name]);

        return $objectManager;
    }
1117743
public function loadHelper($helperName, $config = array())
    {
        $helper = Helper::factory($helperName, $config);
        $name = array_key_exists("name", (array)$config) ? $config["name"] : $helper->getShortName();
        $this->set($name, $helper);
    }
179568
public static function getControllerName($qualifiedControllerName)
    {
        $nsComponents = explode('\\', $qualifiedControllerName);
        $ctrlName = str_replace('Controller', '', end($nsComponents));

        return $ctrlName;
    }
141551
public function getConfiguredHandler($handlerName)
    {
        if (!isset($this->handlersMap[$handlerName])) {
            throw new InvalidConfigurationException("Unknown handler $handlerName");
        }

        return $this->container->get($this->handlersMap[$handlerName]);
    }