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\CommandCode
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);
}