From 7361875389c0969e3cd6322478719b125c3adc27 Mon Sep 17 00:00:00 2001 From: Joe Green Date: Fri, 9 Jan 2015 12:52:02 +0000 Subject: [PATCH] rename package --- README.md | 14 ++++----- composer.json | 2 +- src/Phroute/Dispatcher.php | 6 ++-- src/Phroute/Exception/BadRouteException.php | 2 +- src/Phroute/Exception/HttpException.php | 2 +- .../HttpMethodNotAllowedException.php | 2 +- .../Exception/HttpRouteNotFoundException.php | 2 +- src/Phroute/HandlerResolver.php | 2 +- src/Phroute/HandlerResolverInterface.php | 2 +- src/Phroute/Route.php | 2 +- src/Phroute/RouteCollector.php | 6 ++-- src/Phroute/RouteDataArray.php | 2 +- src/Phroute/RouteDataInterface.php | 4 +-- src/Phroute/RouteDataProviderInterface.php | 4 +-- src/Phroute/RouteParser.php | 4 +-- test/Dispatcher/DispatcherTest.php | 30 +++++++++---------- 16 files changed, 43 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index dc02aa4..3f1807b 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ syntax by passing using a different route parser. ```php -$router = new Phroute\Router\RouteCollector(); +$router = new Phroute\Phroute\RouteCollector(); $router->any('/example', function(){ @@ -97,7 +97,7 @@ $router->addRoute('GET', '/user/{id}?', function($id = null) { }); # NB. You can cache the return value from $router->getData() so you don't have to create the routes each request - massive speed gains -$dispatcher = new Phroute\Router\Dispatcher($router->getData()); +$dispatcher = new Phroute\Phroute\Dispatcher($router->getData()); $response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); @@ -241,16 +241,16 @@ A URI is dispatched by calling the `dispatch()` method of the created dispatcher accepts the HTTP method and a URI. Getting those two bits of information (and normalizing them appropriately) is your job - this library is not bound to the PHP web SAPIs. -$response = (new Phroute\Router\Dispatcher($router)) +$response = (new Phroute\Phroute\Dispatcher($router)) ->dispatch($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']); The `dispatch()` method will call the matched route, or if no matches, throw one of the exceptions below: # Route not found - Phroute\Router\Exception\HttpRouteNotFoundException; + Phroute\Phroute\Exception\HttpRouteNotFoundException; # Route found, but method not allowed - Phroute\Router\Exception\HttpMethodNotAllowedException; + Phroute\Phroute\Exception\HttpMethodNotAllowedException; > **NOTE:** The HTTP specification requires that a `405 Method Not Allowed` response include the `Allow:` header to detail available methods for the requested resource. @@ -270,7 +270,7 @@ but pimple/pimple or others will work just as well. ~~~PHP use Orno\Di\Container; -use Phroute\Router\HandlerResolverInterface; +use Phroute\Phroute\HandlerResolverInterface; class RouterResolver implements HandlerResolverInterface { @@ -311,7 +311,7 @@ $appContainer = new Orno\Di; $resolver = new RouterResolver($appContainer); -$response = (new Phroute\Router\Dispatcher($router, $resolver))->dispatch($requestMethod, $requestUri); +$response = (new Phroute\Phroute\Dispatcher($router, $resolver))->dispatch($requestMethod, $requestUri); ~~~ diff --git a/composer.json b/composer.json index 5d97e8e..5c42513 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "autoload": { "psr-4": { - "Phroute\\Router\\": "src/Phroute" + "Phroute\\Phroute\\": "src/Phroute" } }, "require": { diff --git a/src/Phroute/Dispatcher.php b/src/Phroute/Dispatcher.php index b0fcdf1..6e637e5 100644 --- a/src/Phroute/Dispatcher.php +++ b/src/Phroute/Dispatcher.php @@ -1,7 +1,7 @@ -setExpectedException('\Phroute\Router\Exception\HttpMethodNotAllowedException',"Allow: " . implode(', ', $allowed)); + $this->setExpectedException('\Phroute\Phroute\Exception\HttpMethodNotAllowedException',"Allow: " . implode(', ', $allowed)); $r = $this->router(); $callback($r); @@ -180,7 +180,7 @@ public function testReverseRouteWithDashes() } /** - * @expectedException \Phroute\Router\Exception\BadRouteException + * @expectedException \Phroute\Phroute\Exception\BadRouteException * @expectedExceptionMessage Expecting route variable 'store' */ public function testMissingParameterReverseRoute() @@ -193,7 +193,7 @@ public function testMissingParameterReverseRoute() } /** - * @expectedException \Phroute\Router\Exception\BadRouteException + * @expectedException \Phroute\Phroute\Exception\BadRouteException * @expectedExceptionMessage Cannot use the same placeholder 'test' twice */ public function testDuplicateVariableNameError() @@ -204,7 +204,7 @@ public function testDuplicateVariableNameError() } /** - * @expectedException \Phroute\Router\Exception\BadRouteException + * @expectedException \Phroute\Phroute\Exception\BadRouteException * @expectedExceptionMessage Cannot register two routes matching 'user/([^/]+)' for method 'GET' */ public function testDuplicateVariableRoute() @@ -219,7 +219,7 @@ public function testDuplicateVariableRoute() } /** - * @expectedException \Phroute\Router\Exception\BadRouteException + * @expectedException \Phroute\Phroute\Exception\BadRouteException * @expectedExceptionMessage Cannot register two routes matching 'user' for method 'GET' */ public function testDuplicateStaticRoute() @@ -234,7 +234,7 @@ public function testDuplicateStaticRoute() } /** - * @expectedException \Phroute\Router\Exception\BadRouteException + * @expectedException \Phroute\Phroute\Exception\BadRouteException * @expectedExceptionMessage Static route 'user/nikic' is shadowed by previously defined variable route 'user/([^/]+)' for method 'GET' */ public function testShadowedStaticRoute() @@ -420,7 +420,7 @@ public function testRestfulControllerMethods() /** - * @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException + * @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException * @expectedExceptionMessage does not exist */ public function testRestfulOptionalRequiredControllerMethodThrows() @@ -433,7 +433,7 @@ public function testRestfulOptionalRequiredControllerMethodThrows() } /** - * @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException + * @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException * @expectedExceptionMessage does not exist */ public function testRestfulRequiredControllerMethodThrows() @@ -446,7 +446,7 @@ public function testRestfulRequiredControllerMethodThrows() } /** - * @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException + * @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException * @expectedExceptionMessage does not exist */ public function testRestfulHyphenateControllerMethodThrows()