Get all of the commands matching the given names.

@param  array  $names
@return \Illuminate\Support\Collection
501436
protected function commandsNamed(array $names)
    {
        return collect($this->commands)->filter(function ($command) use ($names) {
            return in_array($command->name, $names);
        });
    }
296117
public function getNamespaces() {
        $namespaces = [];
        foreach ($this->commands as $command) {
            $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));

            foreach ($command->getAliases() as $alias) {
                $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
            }
        }

        return array_values(array_unique(array_filter($namespaces)));
    }
938726
public function getCommand($command, $aliases = true)
    {
        if (array_key_exists($command, $this->commands)) {
            return $this->commands[$command];
        }

        if (array_key_exists($command, $this->aliases) && $aliases) {
            return $this->commands[$this->aliases[$command]];
        }
    }
730302
protected function getListCommands()
    {
        $commands = $this->application->all();
        $commandsArray = array();
        
        foreach ($commands as $command) {
            $commandsArray[] = array(
                'class'   => get_class($command),
                'name'    => $command->getName()
            );
        }
        
        return $commandsArray;
    }
733895
public function get(string $name): AbstractCommand
	{
		if (!$this->has($name))
		{
			throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
		}

		return $this->container->get($this->commandMap[$name]);
	}
1216387
public function findCommand(array $commands, $commandName) {
        $matches = [];

        foreach ($commands as $command) {
            if ($this->compareCommandName($command->getName(), $commandName)) {
                $matches[] = $command;
            }
        }

        if (count($matches) === 1) {
            return $matches[0];
        } else if (count($matches) === 0) {
            throw new CommandNotFoundException(s(
                'Could not find a command that matches "%s".',
                $commandName
            ));
        } else {
            $qualifiedCommandNames = '';

            foreach ($matches as $command) {
                $qualifiedCommandNames .= "\n" . $command->getName();
            }

            throw new AmbiguousCommandException(s(
                'Please be more precise with the command name. ' .
                'There are several commands that qualify for "%s": %s',
                $commandName,
                $qualifiedCommandNames
            ));
        }
    }
451621
public function findAll(array $names)
    {
        $tags = $this->all();
        $transformTags = function($array) {
                $newArray = array();
                foreach($array as $entry){
                    $newArray[$entry['name']] = $entry;
                }
                return $newArray;
            };
        $tagNames = $transformTags($tags);
        $found = array(
            'tags' => array(),
            'notFound' => array()
        );
        foreach ($names as $name){
            if (in_array($name, array_keys($tagNames))){
                $found['tags'][] = $tagNames[$name];
            } else {
                $found['notFound'][] = $name;
            }
        }
        return $found;
    }
306397
public function getVisibleCommands(): array
    {
        $commands = [];
        foreach ($this->commands as $name => $command) {
            if ($name[0] === '_') {
                continue;
            }

            $commands[$name] = $command;
        }

        return $commands;
    }
88107
private function extractCommands(array $commandsToDispatch)
    {
        $commands = array();
        foreach ($commandsToDispatch as $command) {
            if (is_array($command)) {
                $commands = array_merge($commands, $this->extractCommands($command));
            } elseif ($command instanceof CommandInterface) {
                $commands[] = $command;
            }
        }

        return $commands;
    }
560641
public function all($namespace = null)
    {
        $this->init();

        if (null === $namespace) {
            if (!$this->commandLoader) {
                return $this->commands;
            }

            $commands = $this->commands;
            foreach ($this->commandLoader->getNames() as $name) {
                if (!isset($commands[$name]) && $this->has($name)) {
                    $commands[$name] = $this->get($name);
                }
            }

            return $commands;
        }

        $commands = [];
        foreach ($this->commands as $name => $command) {
            if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
                $commands[$name] = $command;
            }
        }

        if ($this->commandLoader) {
            foreach ($this->commandLoader->getNames() as $name) {
                if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
                    $commands[$name] = $this->get($name);
                }
            }
        }

        return $commands;
    }
801454
protected function parseCommands(array $commands)
    {
        if (!is_array($commands)) {
            return $commands;
        }

        $commandGroups = $this->getConfig('command_groups');
        $sharedCommands = $this->getConfig('shared_commands');

        $results = [];
        foreach ($commands as $command) {
            // If the command is a group, we'll parse through the group of commands
            // and resolve the full class name.
            if (isset($commandGroups[$command])) {
                $results = array_merge(
                    $results, $this->parseCommands($commandGroups[$command])
                );

                continue;

            }

            // If this command is actually a shared command, we'll extract the full
            // class name out of the command list now.
            if (isset($sharedCommands[$command])) {
                $command = $sharedCommands[$command];
            }

            if (!in_array($command, $results)) {
                $results[] = $command;
            }
        }

        return $results;
    }
749515
public function get($name)
    {
        $this->init();

        if (!$this->has($name)) {
            throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
        }

        $command = $this->commands[$name];

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

            $helpCommand = $this->get('help');
            $helpCommand->setCommand($command);

            return $helpCommand;
        }

        return $command;
    }
33897
def _get_commands_by_name(self, blueprint, name):
        
        return list(filter(lambda value: value.name == name, blueprint.get_commands()))
1065258
protected function getCommand(string $name): CommandInterface
    {
        foreach ($this->commands as $command) {
            if ($command->getName() === $name) {
                return $command;
            }
        }

        throw new CommandNotFound($name);
    }
312902
public function get(array $names)
    {
        $records = $this->connection()->pipeline(function ($pipe) use ($names) {
            foreach ($names as $name) {
                $pipe->hmget('supervisor:'.$name, ['name', 'master', 'pid', 'status', 'processes', 'options']);
            }
        });

        return collect($records)->filter()->map(function ($record) {
            $record = array_values($record);

            return ! $record[0] ? null : (object) [
                'name' => $record[0],
                'master' => $record[1],
                'pid' => $record[2],
                'status' => $record[3],
                'processes' => json_decode($record[4], true),
                'options' => json_decode($record[5], true),
            ];
        })->filter()->all();
    }
1050675
public function getCommands()
    {
        foreach ($this->commands as $command) {
            if ($command instanceof \Traversable) {
                //Nested commands
                yield from $command;
            }

            yield $command;
        }
    }
1328259
public function findNotInNames(array $names)
    {
        return $this->getEntityManager()
            ->createQuery('SELECT r FROM GloobyTaskBundle:Schedule r WHERE r.name NOT IN (:names)')
            ->setParameter('names', $names)
            ->useQueryCache(true)
            ->getResult();
    }