From bec2f11699e4b9736c4c0b33160e2fb5880a1a61 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 3 Oct 2015 05:17:36 +0700 Subject: [PATCH 1/2] remove GianArb\ namespace prefix #81 --- composer.json | 4 ++-- src/App.php | 8 ++++---- src/Config/Loader.php | 2 +- src/Container/PHPDiFactory.php | 4 ++-- src/Dispatcher.php | 6 +++--- src/Event/HttpFlowEvent.php | 2 +- src/Exception/MethodNotAllowed.php | 2 +- src/Exception/RouteNotFound.php | 2 +- tests/AppLoaderTest.php | 8 ++++---- tests/AppTest.php | 12 ++++++------ tests/Config/LoaderTest.php | 4 ++-- tests/DiTest.php | 8 ++++---- tests/DispatcherTest.php | 8 ++++---- tests/EventFlowTest.php | 12 ++++++------ tests/Http/SymfonyKernelTest.php | 10 +++++----- tests/Utils/FastSymfonyDispatcher.php | 6 +++--- 16 files changed, 49 insertions(+), 49 deletions(-) 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/src/App.php b/src/App.php index abec694..3f64c2d 100644 --- a/src/App.php +++ b/src/App.php @@ -1,11 +1,11 @@ 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; From ce62ceca4a92ce0328d4548c2d48200ddfd84b8a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 3 Oct 2015 05:19:48 +0700 Subject: [PATCH 2/2] remove \GianArb prefix in docs as well --- docs/flow.md | 6 +++--- docs/getting-started.md | 4 ++-- docs/the-dispatcher-concept.md | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) 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