public function add($method, $url = null, $handler = null) : RouterInterface
    {
        $temp = [ 'method' => [ 'GET', 'POST' ], 'url' => '', 'handler' => null ];
        foreach (func_get_args() as $arg) {
            if (is_callable($arg)) {
                $temp['handler'] = $arg;
            } else if (in_array($arg, ['GET', 'HEAD', 'POST', 'PATCH', 'DELETE', 'PUT', 'OPTIONS', 'REPORT'])) {
                $temp['method'] = $arg;
            } else {
                $temp['url'] = $arg;
            }
        }
        list($method, $url, $handler) = array_values($temp);

        if (!$url && $this->prefix) {
            $url = $this->prefix;
        } else {
            if (!$url) {
                $url = '{**}';
            }
            $url = $this->prefix.$url;
        }

        if (!$method) {
            $method = ['GET','POST'];
        }
        if (!is_array($method)) {
            $method = [$method];
        }
        if (!is_callable($handler)) {
            throw new RouterException('No valid handler found');
        }

        foreach ($method as $m) {
            if (!isset($this->routes[$m])) {
                $this->routes[$m] = [];
            }
            $this->routes[$m][$url] = $handler;
        }

        return $this;
    }