public function to($handler)
{
if (!is_string($handler) && !is_object($handler) && !is_callable($handler)) {
throw new Exception\InvalidArgumentException(sprintf("Invalid handler provided. Expected type is string, object or callable but type of %s given.", gettype($handler)));
}
if (null === $this->tmpPattern) {
throw new Exception\RuntimeException(sprintf("Cannot map handler %s to a pattern. Please use method route before calling method to", is_object($handler) ? get_class($handler) : is_string($handler) ? $handler : gettype($handler)));
}
$this->patternMap[] = [$this->tmpPattern => $handler];
$this->tmpPattern = null;
return $this;
}