original_string: public function on($method, $listener)
      {
          if (!array_key_exists($method, $this->_listeners)) {
              $this->_listeners[$method] = [];
          }
  
          array_push($this->_listeners[$method], $listener);
      }
code: public function on($method, $listener)
      {
          if (!array_key_exists($method, $this->_listeners)) {
              $this->_listeners[$method] = [];
          }
  
          array_push($this->_listeners[$method], $listener);
      }
code_tokens: public function on ( $ method , $ listener ) { if ( ! array_key_exists ( $ method , $ this -> _listeners ) ) { $ this -> _listeners [ $ method ] = [ ] ; } array_push ( $ this -> _listeners [ $ method ] , $ listener ) ; }
docstring: Adds a request listener.
  
  Example:
  
  $c = new HttpController();
  $c->on("PUT", function () {
  echo "Processing PUT request\n";
  });
  $c->processRequest();
  
  @param string   $method   Method name (GET, POST, PUT, etc...)
  @param callable $listener Request listener
  
  @return void
docstring_tokens: Adds a request listener .