public function route($pathOrRoute, $callback = null) {
        if (is_object($pathOrRoute) && $pathOrRoute instanceof Route) {
            $route = $pathOrRoute;
        } elseif (is_string($pathOrRoute) && $callback !== null) {
            $route = Route::create($pathOrRoute, $callback);
        } else {
            throw new \InvalidArgumentException("Argument #1 must be either a Garden\\Route or a string.", 500);
        }
        $this->routes[] = $route;
        return $route;
    }
public function route($pathOrRoute, $callback = null) {
        if (is_object($pathOrRoute) && $pathOrRoute instanceof Route) {
            $route = $pathOrRoute;
        } elseif (is_string($pathOrRoute) && $callback !== null) {
            $route = Route::create($pathOrRoute, $callback);
        } else {
            throw new \InvalidArgumentException("Argument #1 must be either a Garden\\Route or a string.", 500);
        }
        $this->routes[] = $route;
        return $route;
    }
public function route ( $ pathOrRoute , $ callback = null ) { if ( is_object ( $ pathOrRoute ) && $ pathOrRoute instanceof Route ) { $ route = $ pathOrRoute ; } elseif ( is_string ( $ pathOrRoute ) && $ callback !== null ) { $ route = Route :: create ( $ pathOrRoute , $ callback ) ; } else { throw new \ InvalidArgumentException ( "Argument #1 must be either a Garden\\Route or a string." , 500 ) ; } $ this -> routes [ ] = $ route ; return $ route ; }
Add a new route.

@param string|Route $pathOrRoute The path to the route or the {@link Route} object itself.
@param callable|string|null $callback Either a callback to map the route to or a string representing
a format for {@link sprintf()}.
@return Route Returns the route that was added.
@throws \InvalidArgumentException Throws an exceptio if {@link $path} isn't a string or {@link Route}.
Add a new route .