fix travis build
authorStricted <info@stricted.net>
Sun, 17 Jul 2016 05:26:56 +0000 (07:26 +0200)
committerStricted <info@stricted.net>
Sun, 17 Jul 2016 05:26:56 +0000 (07:26 +0200)
lib/system/RequestHandler.class.php
lib/system/route/Literal.class.php
lib/system/route/Regex.class.php

index d08c0b3a89b1b066572a8112f6433b2539be7a62..1877b484c46fed36c33cb75da0013a77d80546b3 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 namespace dns\system;
 use dns\system\cache\builder\ControllerCacheBuilder;
-use dns\system\route\Request;
 use dns\system\route\Literal;
 use dns\system\route\Regex;
+use dns\system\route\Request;
 use Zend\Mvc\Router\SimpleRouteStack;
 
 /**
index e5f98860719266d76cad697957bf429c002e5742..cb39a89ed06f52f3ea276ff5668e6e40c769d047 100644 (file)
@@ -1,34 +1,33 @@
 <?php
 namespace dns\system\route;
 use Zend\Mvc\Router\Http\Literal as LiteralBase;
-use Zend\Stdlib\RequestInterface as Request;
 use Zend\Mvc\Router\Http\RouteMatch;
+use Zend\Stdlib\RequestInterface as Request;
 
 class Literal extends LiteralBase {
-    public function match(Request $request, $pathOffset = null)
-    {
-        if (!method_exists($request, 'getUri')) {
-            return;
-        }
+       public function match(Request $request, $pathOffset = null) {
+               if (!method_exists($request, 'getUri')) {
+                       return;
+               }
+
+               $uri  = $request->getUri();
+               $path = $uri->getPath();
 
-        $uri  = $request->getUri();
-        $path = $uri->getPath();
+               if ($pathOffset !== null) {
+                       if ($pathOffset >= 0 && strlen($path) >= $pathOffset && !empty($this->route)) {
+                               if (strpos($path, $this->route, $pathOffset) === $pathOffset) {
+                                       return new RouteMatch($this->defaults, strlen($this->route));
+                               }
+                       }
 
-        if ($pathOffset !== null) {
-            if ($pathOffset >= 0 && strlen($path) >= $pathOffset && !empty($this->route)) {
-                if (strpos($path, $this->route, $pathOffset) === $pathOffset) {
-                    return new RouteMatch($this->defaults, strlen($this->route));
-                }
-            }
+                       return;
+               }
 
-            return;
-        }
-               
-        if (mb_strtolower($path) === mb_strtolower($this->route)) {
-            return new RouteMatch($this->defaults, strlen($this->route));
-        }
+               if (mb_strtolower($path) === mb_strtolower($this->route)) {
+                       return new RouteMatch($this->defaults, strlen($this->route));
+               }
 
-        return;
-    }
+               return;
+       }
 }
 
index 049cb871655ac4e7f6e9e5588dd77945d896496c..c411423acb40b8e603ada157c15cd2fee7d1e74e 100644 (file)
@@ -1,39 +1,40 @@
 <?php
 namespace dns\system\route;
 use Zend\Mvc\Router\Http\Regex as RegexBase;
-use Zend\Stdlib\RequestInterface as Request;
 use Zend\Mvc\Router\Http\RouteMatch;
+use Zend\Stdlib\RequestInterface as Request;
 
 class Regex extends RegexBase {
-    public function match(Request $request, $pathOffset = null)
-    {
-        if (!method_exists($request, 'getUri')) {
-            return;
-        }
+       public function match(Request $request, $pathOffset = null) {
+               if (!method_exists($request, 'getUri')) {
+                       return;
+               }
+
+               $uri  = $request->getUri();
+               $path = $uri->getPath();
 
-        $uri  = $request->getUri();
-        $path = $uri->getPath();
+               if ($pathOffset !== null) {
+                       $result = preg_match('(\G' . $this->regex . ')i', $path, $matches, null, $pathOffset);
+               }
+               else {
+                       $result = preg_match('(^' . $this->regex . '$)i', $path, $matches);
+               }
 
-        if ($pathOffset !== null) {
-            $result = preg_match('(\G' . $this->regex . ')i', $path, $matches, null, $pathOffset);
-        } else {
-            $result = preg_match('(^' . $this->regex . '$)i', $path, $matches);
-        }
+               if (!$result) {
+                       return;
+               }
 
-        if (!$result) {
-            return;
-        }
+               $matchedLength = strlen($matches[0]);
 
-        $matchedLength = strlen($matches[0]);
+               foreach ($matches as $key => $value) {
+                       if (is_numeric($key) || is_int($key) || $value === '') {
+                               unset($matches[$key]);
+                       }
+                       else {
+                               $matches[$key] = rawurldecode($value);
+                       }
+               }
 
-        foreach ($matches as $key => $value) {
-            if (is_numeric($key) || is_int($key) || $value === '') {
-                unset($matches[$key]);
-            } else {
-                $matches[$key] = rawurldecode($value);
-            }
-        }
-               
-        return new RouteMatch(array_merge($this->defaults, $matches), $matchedLength);
-    }
+               return new RouteMatch(array_merge($this->defaults, $matches), $matchedLength);
+       }
 }