From 92b7dd3335a6572debeacfb5faa82c63a5e67888 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 8 Jun 2018 20:03:25 +0200 Subject: Some minor fixes --- main/app/sprinkles/core/src/Router.php | 200 ++++++++++++++++----------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'main/app/sprinkles/core/src/Router.php') diff --git a/main/app/sprinkles/core/src/Router.php b/main/app/sprinkles/core/src/Router.php index 09a358a..1554fa9 100644 --- a/main/app/sprinkles/core/src/Router.php +++ b/main/app/sprinkles/core/src/Router.php @@ -1,100 +1,100 @@ -routeGroups) { - $pattern = $this->processGroups() . $pattern; - } - - // According to RFC methods are defined in uppercase (See RFC 7231) - $methods = array_map("strtoupper", $methods); - - // Determine route signature - $signature = implode('-', $methods) . '-' . $pattern; - - // If a route with the same signature already exists, then we must replace it - if (isset($this->identifiers[$signature])) { - $route = new \Slim\Route($methods, $pattern, $handler, $this->routeGroups, str_replace('route', '', $this->identifiers[$signature])); - } else { - $route = new \Slim\Route($methods, $pattern, $handler, $this->routeGroups, $this->routeCounter); - } - - $this->routes[$route->getIdentifier()] = $route; - - // Record identifier in reverse lookup array - $this->identifiers[$signature] = $route->getIdentifier(); - - $this->routeCounter++; - - return $route; - } - - /** - * Delete the cache file - * - * @access public - * @return bool true/false if operation is successfull - */ - public function clearCache() { - // Get Filesystem instance - $fs = new FileSystem; - - // Make sure file exist and delete it - if ($fs->exists($this->cacheFile)) { - return $fs->delete($this->cacheFile); - } - - // It's still considered a success if file doesn't exist - return TRUE; - } -} +routeGroups) { + $pattern = $this->processGroups() . $pattern; + } + + // According to RFC methods are defined in uppercase (See RFC 7231) + $methods = array_map("strtoupper", $methods); + + // Determine route signature + $signature = implode('-', $methods) . '-' . $pattern; + + // If a route with the same signature already exists, then we must replace it + if (isset($this->identifiers[$signature])) { + $route = new \Slim\Route($methods, $pattern, $handler, $this->routeGroups, str_replace('route', '', $this->identifiers[$signature])); + } else { + $route = new \Slim\Route($methods, $pattern, $handler, $this->routeGroups, $this->routeCounter); + } + + $this->routes[$route->getIdentifier()] = $route; + + // Record identifier in reverse lookup array + $this->identifiers[$signature] = $route->getIdentifier(); + + $this->routeCounter++; + + return $route; + } + + /** + * Delete the cache file + * + * @access public + * @return bool true/false if operation is successfull + */ + public function clearCache() { + // Get Filesystem instance + $fs = new FileSystem; + + // Make sure file exist and delete it + if ($fs->exists($this->cacheFile)) { + return $fs->delete($this->cacheFile); + } + + // It's still considered a success if file doesn't exist + return TRUE; + } +} -- cgit v1.2.3