original_string: public function on($method, $path, $handler, $name = '') {
  		if (!$this->result->hasHandler()
  			&& $this->prefixMatched
  			&& $this->request->isMethod($method)
  		) {
  			if ($this->matchPartial($path, true)) {
  				$handlers = (array)$handler;
  
  				if ($this->namespace) {
  					foreach ($handlers as &$handler) {
  						$handler = $this->namespace . $handler;
  					}
  				}
  
  				if ($this->middlewares) {
  					$handlers = array_merge($this->middlewares, $handlers);
  				}
  
  				$this->result->setHandler($handlers);
  				$this->result->setStatus(200);
  				$this->result->setParams($this->params);
  			}
  		}
  
  		if ($name) {
  			$this->urlGenerator->add($name, $this->prefix . $path);
  		}
  
  		return $this;
  	}
code: public function on($method, $path, $handler, $name = '') {
  		if (!$this->result->hasHandler()
  			&& $this->prefixMatched
  			&& $this->request->isMethod($method)
  		) {
  			if ($this->matchPartial($path, true)) {
  				$handlers = (array)$handler;
  
  				if ($this->namespace) {
  					foreach ($handlers as &$handler) {
  						$handler = $this->namespace . $handler;
  					}
  				}
  
  				if ($this->middlewares) {
  					$handlers = array_merge($this->middlewares, $handlers);
  				}
  
  				$this->result->setHandler($handlers);
  				$this->result->setStatus(200);
  				$this->result->setParams($this->params);
  			}
  		}
  
  		if ($name) {
  			$this->urlGenerator->add($name, $this->prefix . $path);
  		}
  
  		return $this;
  	}
code_tokens: public function on ( $ method , $ path , $ handler , $ name = '' ) { if ( ! $ this -> result -> hasHandler ( ) && $ this -> prefixMatched && $ this -> request -> isMethod ( $ method ) ) { if ( $ this -> matchPartial ( $ path , true ) ) { $ handlers = ( array ) $ handler ; if ( $ this -> namespace ) { foreach ( $ handlers as & $ handler ) { $ handler = $ this -> namespace . $ handler ; } } if ( $ this -> middlewares ) { $ handlers = array_merge ( $ this -> middlewares , $ handlers ) ; } $ this -> result -> setHandler ( $ handlers ) ; $ this -> result -> setStatus ( 200 ) ; $ this -> result -> setParams ( $ this -> params ) ; } } if ( $ name ) { $ this -> urlGenerator -> add ( $ name , $ this -> prefix . $ path ) ; } return $ this ; }
docstring: Add a route.
  
  @param string $method
  @param string $path
  @param string|string[] $handler
  @param string $name Route name.
  @return self
docstring_tokens: Add a route .