public function getCommandIfExists($string)
    {
        if (starts_with($string, $this->id)) {
            foreach ($this->commands as $commandName => $command) {
                if (starts_with($string, $this->id.$commandName)) {
                    return $command;
                }
            }
        }
    }
public function getCommandIfExists($string)
    {
        if (starts_with($string, $this->id)) {
            foreach ($this->commands as $commandName => $command) {
                if (starts_with($string, $this->id.$commandName)) {
                    return $command;
                }
            }
        }
    }
public function getCommandIfExists ( $ string ) { if ( starts_with ( $ string , $ this -> id ) ) { foreach ( $ this -> commands as $ commandName => $ command ) { if ( starts_with ( $ string , $ this -> id . $ commandName ) ) { return $ command ; } } } }
Check if the given string contains a command
if so, return the registered command.

@param string $string Received Message

@return Command Returns the command or null
Check if the given string contains a command if so return the registered command .