public function addHook($command, $callable)
    {
        if (!isset($this->hooks[$command])) {
            $this->hooks[$command] = [];
        } else {
            $k = array_search($callable, $this->hooks[$command]);
            if ($k !== false) {
                return;
            }
            unset($k);
        }

        $this->hooks[$command][] = $callable;
    }
public function addHook($command, $callable)
    {
        if (!isset($this->hooks[$command])) {
            $this->hooks[$command] = [];
        } else {
            $k = array_search($callable, $this->hooks[$command]);
            if ($k !== false) {
                return;
            }
            unset($k);
        }

        $this->hooks[$command][] = $callable;
    }
public function addHook ( $ command , $ callable ) { if ( ! isset ( $ this -> hooks [ $ command ] ) ) { $ this -> hooks [ $ command ] = [ ] ; } else { $ k = array_search ( $ callable , $ this -> hooks [ $ command ] ) ; if ( $ k !== false ) { return ; } unset ( $ k ) ; } $ this -> hooks [ $ command ] [ ] = $ callable ; }
Attach a Listener to a Hook.

@param string   $command  Hook to listen for
@param callable $callable A callable with the signature (Server, Socket, string).
Callable should return false if it wishes to stop the server, and true if it wishes to continue.

@return void
Attach a Listener to a Hook .