diff --git a/composer.json b/composer.json index a2af214..6ae3673 100644 --- a/composer.json +++ b/composer.json @@ -29,12 +29,12 @@ ], "autoload": { "psr-4": { - "GianArb\\Penny\\": "./src" + "Penny\\": "./src" } }, "autoload-dev": { "psr-4": { - "GianArb\\PennyTest\\": "./tests", + "PennyTest\\": "./tests", "TestApp\\": "./tests/app" } } diff --git a/docs/flow.md b/docs/flow.md index 620c1f3..6f181d9 100644 --- a/docs/flow.md +++ b/docs/flow.md @@ -9,8 +9,8 @@ Dispatcher tries to match router and request, if this match exists it returns th There are two possible kind of problems: -* Route doesn't exist, an `GianArb\Penny\Exception\RouteNotFound` Exception is thrown; -* Route exists but the HTTP Method hasn't been matched, an `GianArb\Penny\Exception\MethodNotAllowed` Exception is thrown; +* Route doesn't exist, an `Penny\Exception\RouteNotFound` Exception is thrown; +* Route exists but the HTTP Method hasn't been matched, an `Penny\Exception\MethodNotAllowed` Exception is thrown; If no exception are thrown, a response is returned back. @@ -35,7 +35,7 @@ chdir(dirname(__DIR__)); require_once "./vendor/autoload.php"; -$app = new \GianArb\Penny\App(); +$app = new \Penny\App(); $app->getContainer()->get("event_manager")->attach("*", function ($event) { $e = $event->getException(); diff --git a/docs/getting-started.md b/docs/getting-started.md index 8de7f01..fac5a3e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -54,7 +54,7 @@ Every application has an entry point, `public/index.php` is our. chdir(dirname(__DIR__)); require "vendor/autoload.php"; -$app = new \GianArb\Penny\App(); +$app = new \Penny\App(); $emitter = new \Zend\Diactoros\Response\SapiEmitter(); $emitter->emit($app->run()); ``` @@ -359,7 +359,7 @@ Doctrine has an awesome console that helps you to manage database, schema, cache // cli-config.php require "vendor/autoload.php"; -$app = new \GianArb\Penny\App(); +$app = new \Penny\App(); return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($app->getContainer()->get("doctrine.em")); ``` diff --git a/docs/the-dispatcher-concept.md b/docs/the-dispatcher-concept.md index c951cd2..b9cf5b4 100644 --- a/docs/the-dispatcher-concept.md +++ b/docs/the-dispatcher-concept.md @@ -54,10 +54,10 @@ class FastSymfonyDispatcher $routeInfo = $this->router->dispatch($request->getMethod(), $request->getPathInfo()); switch ($routeInfo[0]) { case \FastRoute\Dispatcher::NOT_FOUND: - throw new \GianArb\Penny\Exception\RouteNotFound(); + throw new \Penny\Exception\RouteNotFound(); break; case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED: - throw new \GianArb\Penny\Exception\MethodNotAllowed(); + throw new \Penny\Exception\MethodNotAllowed(); break; case \FastRoute\Dispatcher::FOUND: return $routeInfo; @@ -75,7 +75,7 @@ class FastSymfonyDispatcher ```php addDefinitions( [ 'event_manager' => DI\object('Zend\EventManager\EventManager'), - 'dispatcher' => DI\object('GianArb\Penny\Dispatcher') + 'dispatcher' => DI\object('Penny\Dispatcher') ->constructor(DI\get('router')), ] ); diff --git a/src/Dispatcher.php b/src/Dispatcher.php index 7a78f9f..7788654 100644 --- a/src/Dispatcher.php +++ b/src/Dispatcher.php @@ -1,12 +1,12 @@ setExpectedException('GianArb\Penny\Exception\RouteNotFound'); + $this->setExpectedException('Penny\Exception\RouteNotFound'); $request = (new Request()) ->withUri(new Uri('/doh')) ->withMethod('GET'); @@ -46,7 +46,7 @@ public function testDispatchRouteNotFoundRequest() public function testDispatchMethodNotAllowedRequest() { - $this->setExpectedException('GianArb\Penny\Exception\MethodNotAllowed'); + $this->setExpectedException('Penny\Exception\MethodNotAllowed'); $request = (new Request()) ->withUri(new Uri('/')) ->withMethod('POST'); diff --git a/tests/EventFlowTest.php b/tests/EventFlowTest.php index e968257..bd5785e 100644 --- a/tests/EventFlowTest.php +++ b/tests/EventFlowTest.php @@ -1,13 +1,13 @@ addRoute('GET', '/', [get_class($this), 'index']); }); - $config['dispatcher'] = \Di\object('GianArb\PennyTest\Utils\FastSymfonyDispatcher') + $config['dispatcher'] = \Di\object('PennyTest\Utils\FastSymfonyDispatcher') ->constructor(\Di\get("router")); $this->app = new App(Container\PHPDiFactory::buildContainer($config)); diff --git a/tests/Utils/FastSymfonyDispatcher.php b/tests/Utils/FastSymfonyDispatcher.php index dcfc561..81a8781 100644 --- a/tests/Utils/FastSymfonyDispatcher.php +++ b/tests/Utils/FastSymfonyDispatcher.php @@ -1,6 +1,6 @@ dispatch($request->getMethod(), $request->getPathInfo()); switch ($routeInfo[0]) { case \FastRoute\Dispatcher::NOT_FOUND: - throw new \GianArb\Penny\Exception\RouteNotFound(); + throw new \Penny\Exception\RouteNotFound(); break; case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED: - throw new \GianArb\Penny\Exception\MethodNotAllowed(); + throw new \Penny\Exception\MethodNotAllowed(); break; case \FastRoute\Dispatcher::FOUND: return $routeInfo;