Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Command.php

function Command::getHelper

Gets a helper instance by name.

Throws

LogicException if no HelperSet is defined

InvalidArgumentException if the helper is not defined

2 methods override Command::getHelper()
LazyCommand::getHelper in vendor/symfony/console/Command/LazyCommand.php
Gets a helper instance by name.
TraceableCommand::getHelper in vendor/symfony/console/Command/TraceableCommand.php
Gets a helper instance by name.

File

vendor/symfony/console/Command/Command.php, line 642

Class

Command
Base class for all commands.

Namespace

Symfony\Component\Console\Command

Code

public function getHelper(string $name) : HelperInterface {
    if (null === $this->helperSet) {
        throw new LogicException(\sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
    }
    return $this->helperSet
        ->get($name);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal