OSDN Git Service

avoid calling getName twice per route
authormaks feltrin <pine3ree@gmail.com>
Wed, 10 Feb 2016 17:10:55 +0000 (18:10 +0100)
committermaks feltrin <pine3ree@gmail.com>
Wed, 10 Feb 2016 17:10:55 +0000 (18:10 +0100)
src/PHPRouter/Router.php

index a307ae8..b9e7260 100755 (executable)
@@ -52,8 +52,9 @@ class Router
         $this->routes = $collection;
 
         foreach ($this->routes->all() as $route) {
-            if (!is_null($route->getName())) {
-                $this->namedRoutes[$route->getName()] = $route;
+            $name = $route->getName();
+            if (null !== $name) {
+                $this->namedRoutes[$name] = $route;
             }
         }
     }