src/BotsManager.php
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;
    }
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;
    }
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 ; }
Parse an array of commands and build a list.

@param array $commands

@return array
Parse an array of commands and build a list .