class Shell

  1. 8.0.x lib/Drush/Psysh/Shell.php Shell
  2. master lib/Drush/Psysh/Shell.php Shell

Namespace

Drush\Psysh

Hierarchy

  • class Shell extends \Psy\Shell

Expanded class hierarchy of Shell

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
Shell::getCommand protected function Get a command (if one exists) for the current input string.
Shell::getCommandFromInput protected function Get the command from the current input, takes aliases into account.
Shell::hasCommand protected function Check whether a command is set for the current input string.

File

lib/Drush/Psysh/Shell.php, line 13
Contains \Drush\Psysh\Shell.

View source
class Shell extends BaseShell {

  /**
   * Get a command (if one exists) for the current input string.
   *
   * @param string $input
   *
   * @return null|Command
   */
  protected function getCommand($input) {
    if ($name = $this->getCommandFromInput($input)) {
      return $this->get($name);
    }
  }

  /**
   * Check whether a command is set for the current input string.
   *
   * @param string $input
   *
   * @return bool True if the shell has a command for the given input.
   */
  protected function hasCommand($input) {
    if ($name = $this->getCommandFromInput($input)) {
      return $this->has($name);
    }

    return false;
  }

  /**
   * Get the command from the current input, takes aliases into account.
   *
   * @param string $input
   *   The raw input
   *
   * @return string|NULL
   *   The current command.
   */
  protected function getCommandFromInput($input) {
    // Remove the alias from the start of the string before parsing and
    // returning the command. Essentially, when choosing a command, we're
    // ignoring the site alias.
    $input = preg_replace('|^\@[^\s]+|', '', $input);

    $input = new StringInput($input);
    return $input->getFirstArgument();
  }

}
1 file declares its use of Shell
cli.drush.inc in commands/core/cli.drush.inc