Skip to content

Commit

Permalink
rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjgreen committed Jan 9, 2015
1 parent da690fb commit 7361875
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 43 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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.
Expand All @@ -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
{
Expand Down Expand Up @@ -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);

~~~

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"autoload": {
"psr-4": {
"Phroute\\Router\\": "src/Phroute"
"Phroute\\Phroute\\": "src/Phroute"
}
},
"require": {
Expand Down
6 changes: 3 additions & 3 deletions src/Phroute/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

use Phroute\Router\Exception\HttpMethodNotAllowedException;
use Phroute\Router\Exception\HttpRouteNotFoundException;
use Phroute\Phroute\Exception\HttpMethodNotAllowedException;
use Phroute\Phroute\Exception\HttpRouteNotFoundException;

class Dispatcher {

Expand Down
2 changes: 1 addition & 1 deletion src/Phroute/Exception/BadRouteException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router\Exception;
<?php namespace Phroute\Phroute\Exception;

class BadRouteException extends \LogicException {
}
2 changes: 1 addition & 1 deletion src/Phroute/Exception/HttpException.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php namespace Phroute\Router\Exception;
<?php namespace Phroute\Phroute\Exception;

class HttpException extends \Exception {}
2 changes: 1 addition & 1 deletion src/Phroute/Exception/HttpMethodNotAllowedException.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php namespace Phroute\Router\Exception;
<?php namespace Phroute\Phroute\Exception;

class HttpMethodNotAllowedException extends HttpException {}
2 changes: 1 addition & 1 deletion src/Phroute/Exception/HttpRouteNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router\Exception;
<?php namespace Phroute\Phroute\Exception;

class HttpRouteNotFoundException extends HttpException {}

2 changes: 1 addition & 1 deletion src/Phroute/HandlerResolver.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

class HandlerResolver implements HandlerResolverInterface {

Expand Down
2 changes: 1 addition & 1 deletion src/Phroute/HandlerResolverInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

interface HandlerResolverInterface {

Expand Down
2 changes: 1 addition & 1 deletion src/Phroute/Route.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

class Route {

Expand Down
6 changes: 3 additions & 3 deletions src/Phroute/RouteCollector.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

use ReflectionClass;
use ReflectionMethod;

use Phroute\Router\Exception\BadRouteException;
use Phroute\Phroute\Exception\BadRouteException;

/**
* Class RouteCollector
* @package Phroute\Router
* @package Phroute\Phroute
*/
class RouteCollector implements RouteDataProviderInterface {

Expand Down
2 changes: 1 addition & 1 deletion src/Phroute/RouteDataArray.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

class RouteDataArray implements RouteDataInterface {

Expand Down
4 changes: 2 additions & 2 deletions src/Phroute/RouteDataInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;


/**
* Interface RouteDataInterface
* @package Phroute\Router
* @package Phroute\Phroute
*/
interface RouteDataInterface {

Expand Down
4 changes: 2 additions & 2 deletions src/Phroute/RouteDataProviderInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;


/**
* Interface RouteDataProviderInterface
* @package Phroute\Router
* @package Phroute\Phroute
*/
interface RouteDataProviderInterface {

Expand Down
4 changes: 2 additions & 2 deletions src/Phroute/RouteParser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Phroute\Router;
<?php namespace Phroute\Phroute;

use Phroute\Router\Exception\BadRouteException;
use Phroute\Phroute\Exception\BadRouteException;
/**
* Parses routes of the following form:
*
Expand Down
30 changes: 15 additions & 15 deletions test/Dispatcher/DispatcherTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Phroute\Router\Dispatcher;
namespace Phroute\Phroute\Dispatcher;

use Phroute\Router\RouteCollector;
use Phroute\Router\RouteParser;
use Phroute\Router\Dispatcher;
use Phroute\Router\Route;
use Phroute\Phroute\RouteCollector;
use Phroute\Phroute\RouteParser;
use Phroute\Phroute\Dispatcher;
use Phroute\Phroute\Route;

class Test {

Expand Down Expand Up @@ -113,7 +113,7 @@ public function testFoundDispatches($method, $uri, $callback, $expected)

/**
* @dataProvider provideNotFoundDispatchCases
* @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException
* @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException
* @expectedExceptionMessage does not exist
*/
public function testNotFoundDispatches($method, $uri, $callback)
Expand All @@ -128,7 +128,7 @@ public function testNotFoundDispatches($method, $uri, $callback)
*/
public function testMethodNotAllowedDispatches($method, $uri, $callback, $allowed)
{
$this->setExpectedException('\Phroute\Router\Exception\HttpMethodNotAllowedException',"Allow: " . implode(', ', $allowed));
$this->setExpectedException('\Phroute\Phroute\Exception\HttpMethodNotAllowedException',"Allow: " . implode(', ', $allowed));

$r = $this->router();
$callback($r);
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -420,7 +420,7 @@ public function testRestfulControllerMethods()


/**
* @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException
* @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException
* @expectedExceptionMessage does not exist
*/
public function testRestfulOptionalRequiredControllerMethodThrows()
Expand All @@ -433,7 +433,7 @@ public function testRestfulOptionalRequiredControllerMethodThrows()
}

/**
* @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException
* @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException
* @expectedExceptionMessage does not exist
*/
public function testRestfulRequiredControllerMethodThrows()
Expand All @@ -446,7 +446,7 @@ public function testRestfulRequiredControllerMethodThrows()
}

/**
* @expectedException \Phroute\Router\Exception\HttpRouteNotFoundException
* @expectedException \Phroute\Phroute\Exception\HttpRouteNotFoundException
* @expectedExceptionMessage does not exist
*/
public function testRestfulHyphenateControllerMethodThrows()
Expand Down

0 comments on commit 7361875

Please sign in to comment.