protected function findChatCommand($cmdAndArgs, $depth, $orig = null)
    {
        if ($depth == 0) {
            return [null, []];
        }

        if ($orig == null) {
            $orig = $cmdAndArgs;
        }

        $cmdAndArgs = array_splice($cmdAndArgs, 0, $depth);
        $parameters = array_diff($orig, $cmdAndArgs);
        $command = implode(' ', $cmdAndArgs);

        return isset($this->commands[$command])
            ? [$this->commands[$command], $parameters]
            : $this->findChatCommand($cmdAndArgs, $depth - 1, $orig);
    }
protected function findChatCommand($cmdAndArgs, $depth, $orig = null)
    {
        if ($depth == 0) {
            return [null, []];
        }

        if ($orig == null) {
            $orig = $cmdAndArgs;
        }

        $cmdAndArgs = array_splice($cmdAndArgs, 0, $depth);
        $parameters = array_diff($orig, $cmdAndArgs);
        $command = implode(' ', $cmdAndArgs);

        return isset($this->commands[$command])
            ? [$this->commands[$command], $parameters]
            : $this->findChatCommand($cmdAndArgs, $depth - 1, $orig);
    }
protected function findChatCommand ( $ cmdAndArgs , $ depth , $ orig = null ) { if ( $ depth == 0 ) { return [ null , [ ] ] ; } if ( $ orig == null ) { $ orig = $ cmdAndArgs ; } $ cmdAndArgs = array_splice ( $ cmdAndArgs , 0 , $ depth ) ; $ parameters = array_diff ( $ orig , $ cmdAndArgs ) ; $ command = implode ( ' ' , $ cmdAndArgs ) ; return isset ( $ this -> commands [ $ command ] ) ? [ $ this -> commands [ $ command ] , $ parameters ] : $ this -> findChatCommand ( $ cmdAndArgs , $ depth - 1 , $ orig ) ; }
Find a chat command.

@param string[] $cmdAndArgs
@param integer  $depth

@return mixed
Find a chat command .