original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Attach a Listener to a Hook .