aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2015-02-17 14:15:47 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-02-17 14:15:47 +0100
commit3af6e244bf48016420d0496a681e767584d7b1f3 (patch)
tree6d4a6935d4431730b3b6cd6086428bd1927f15cf
parent1048433fd45ce9ded4ce0efd27ee7e6a25e28ed9 (diff)
downloadRouter-3af6e244bf48016420d0496a681e767584d7b1f3.zip
Router-3af6e244bf48016420d0496a681e767584d7b1f3.tar.gz
Router-3af6e244bf48016420d0496a681e767584d7b1f3.tar.bz2
Move Hoa\Router\Http to Hoa\Router\Http\Http.
-rw-r--r--Http/Http.php (renamed from Http.php)28
1 files changed, 17 insertions, 11 deletions
diff --git a/Http.php b/Http/Http.php
index 38d829b..1b75646 100644
--- a/Http.php
+++ b/Http/Http.php
@@ -34,9 +34,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace Hoa\Router;
+namespace Hoa\Router\Http;
use Hoa\Core;
+use Hoa\Router;
/**
* Class \Hoa\Router\Http.
@@ -48,7 +49,7 @@ use Hoa\Core;
* @license New BSD License
*/
-class Http extends Generic implements Core\Parameter\Parameterizable {
+class Http extends Router\Generic implements Core\Parameter\Parameterizable {
/**
* Secure connection.
@@ -211,7 +212,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
$call, $able, Array $variables ) {
if(true === $this->ruleExists($id))
- throw new Exception(
+ throw new Router\Exception(
'Cannot add rule %s because it already exists.', 0, $id);
array_walk($methods, function ( &$method ) {
@@ -221,7 +222,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
$diff = array_diff($methods, self::$_methods);
if(!empty($diff))
- throw new Exception(
+ throw new Router\Exception(
(1 == count($diff)
? 'Method %s is'
: 'Methods %s are') .
@@ -283,7 +284,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
$prefix = ltrim($prefix, '/');
if(0 === preg_match('#^' . $prefix . '(.*)?$#', $uri, $matches))
- throw new Exception\NotFound(
+ throw new Router\Exception\NotFound(
'Cannot match the path prefix %s in the URI %s.',
3, [$prefix, $uri]);
@@ -332,7 +333,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
);
if(empty($rules))
- throw new Exception\NotFound(
+ throw new Router\Exception\NotFound(
'No rule to apply to route %s.', 4, $uri);
$gotcha = false;
@@ -354,7 +355,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
}
if(false === $gotcha)
- throw new Exception\NotFound(
+ throw new Router\Exception\NotFound(
'Cannot found an appropriated rule to route %s.', 5, $uri);
if(false !== $pos)
@@ -470,7 +471,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
&& null !== $variables['_subdomain']) {
if(empty($variables['_subdomain']))
- throw new Exception(
+ throw new Router\Exception(
'Subdomain is empty, cannot unroute the rule %s properly.',
6, $id);
@@ -579,7 +580,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
if(true === $allowEmpty)
return '';
else
- throw new Exception(
+ throw new Router\Exception(
'Variable %s is empty and it is not allowed when ' .
'unrouting rule %s.',
7, [$m, $id]);
@@ -656,7 +657,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
return ltrim(@$_SERVER['argv'][1] ?: '', '/');
if(!isset($_SERVER['REQUEST_URI']))
- throw new Exception(
+ throw new Router\Exception(
'Cannot find URI so we cannot route.', 8);
$uri = ltrim(urldecode($_SERVER['REQUEST_URI']), '/');
@@ -679,7 +680,7 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
return [];
if(!isset($_SERVER['REQUEST_URI']))
- throw new Exception(
+ throw new Router\Exception(
'Cannot find URI so we cannot get query.', 9);
$uri = $_SERVER['REQUEST_URI'];
@@ -944,3 +945,8 @@ class Http extends Generic implements Core\Parameter\Parameterizable {
: static::UNSECURE;
}
}
+
+/**
+ * Flex entity.
+ */
+Core\Consistency::flexEntity('Hoa\Router\Http\Http');