Skip to content

Commit be94a3a

Browse files
committed
implement PR 46 from light, Renamed PageHandlerFactory to GetPageViewHandlerFactory, to respect the naming convention
Signed-off-by: arhimede <[email protected]>
1 parent f4be972 commit be94a3a

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/App/src/ConfigProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Light\App;
66

7-
use Light\App\Factory\IndexHandlerFactory;
8-
use Light\App\Handler\IndexHandler;
7+
use Light\App\Factory\GetIndexViewHandlerFactory;
8+
use Light\App\Handler\GetIndexViewHandler;
99
use Mezzio\Application;
1010

1111
class ConfigProvider
@@ -27,7 +27,7 @@ public function getDependencies(): array
2727
],
2828
],
2929
'factories' => [
30-
IndexHandler::class => IndexHandlerFactory::class,
30+
GetIndexViewHandler::class => GetIndexViewHandlerFactory::class,
3131
],
3232
];
3333
}

src/App/src/Factory/IndexHandlerFactory.php renamed to src/App/src/Factory/GetIndexViewHandlerFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44

55
namespace Light\App\Factory;
66

7-
use Light\App\Handler\IndexHandler;
7+
use Light\App\Handler\GetIndexViewHandler;
88
use Mezzio\Template\TemplateRendererInterface;
99
use Psr\Container\ContainerExceptionInterface;
1010
use Psr\Container\ContainerInterface;
1111
use Psr\Container\NotFoundExceptionInterface;
1212

1313
use function assert;
1414

15-
class IndexHandlerFactory
15+
class GetIndexViewHandlerFactory
1616
{
1717
/**
1818
* @param class-string $requestedName
1919
* @throws ContainerExceptionInterface
2020
* @throws NotFoundExceptionInterface
2121
*/
22-
public function __invoke(ContainerInterface $container, string $requestedName): IndexHandler
22+
public function __invoke(ContainerInterface $container, string $requestedName): GetIndexViewHandler
2323
{
2424
$template = $container->get(TemplateRendererInterface::class);
2525
assert($template instanceof TemplateRendererInterface);
2626

27-
return new IndexHandler($template);
27+
return new GetIndexViewHandler($template);
2828
}
2929
}

src/App/src/Handler/IndexHandler.php renamed to src/App/src/Handler/GetIndexViewHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Psr\Http\Message\ServerRequestInterface;
1111
use Psr\Http\Server\RequestHandlerInterface;
1212

13-
class IndexHandler implements RequestHandlerInterface
13+
class GetIndexViewHandler implements RequestHandlerInterface
1414
{
1515
public function __construct(
1616
protected TemplateRendererInterface $template

src/App/src/RoutesDelegator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Light\App;
66

7-
use Light\App\Handler\IndexHandler;
7+
use Light\App\Handler\GetIndexViewHandler;
88
use Mezzio\Application;
99
use Psr\Container\ContainerInterface;
1010

@@ -17,7 +17,7 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
1717
$app = $callback();
1818
assert($app instanceof Application);
1919

20-
$app->get('/', [IndexHandler::class], 'app::index');
20+
$app->get('/', [GetIndexViewHandler::class], 'app::index');
2121

2222
return $app;
2323
}

src/Page/src/ConfigProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Light\Page;
66

7-
use Light\Page\Factory\PageHandlerFactory;
7+
use Light\Page\Factory\GetPageViewHandlerFactory;
88
use Light\Page\Factory\PageServiceFactory;
99
use Light\Page\Handler\GetPageViewHandler;
1010
use Light\Page\Service\PageService;
@@ -30,7 +30,7 @@ public function getDependencies(): array
3030
],
3131
],
3232
'factories' => [
33-
GetPageViewHandler::class => PageHandlerFactory::class,
33+
GetPageViewHandler::class => GetPageViewHandlerFactory::class,
3434
PageService::class => PageServiceFactory::class,
3535
],
3636
'aliases' => [

src/Page/src/Factory/PageHandlerFactory.php renamed to src/Page/src/Factory/GetPageViewHandlerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use function assert;
1414

15-
class PageHandlerFactory
15+
class GetPageViewHandlerFactory
1616
{
1717
/**
1818
* @param class-string $requestedName

test/Unit/App/ConfigProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace LightTest\Unit\App;
66

77
use Light\App\ConfigProvider;
8-
use Light\App\Handler\IndexHandler;
8+
use Light\App\Handler\GetIndexViewHandler;
99
use PHPUnit\Framework\TestCase;
1010

1111
class ConfigProviderTest extends TestCase
@@ -28,7 +28,7 @@ public function testDependenciesHasFactories(): void
2828
{
2929
$this->assertArrayHasKey('factories', $this->config['dependencies']);
3030
$this->assertIsArray($this->config['dependencies']['factories']);
31-
$this->assertArrayHasKey(IndexHandler::class, $this->config['dependencies']['factories']);
31+
$this->assertArrayHasKey(GetIndexViewHandler::class, $this->config['dependencies']['factories']);
3232
}
3333

3434
public function testConfigHasTemplates(): void

0 commit comments

Comments
 (0)