* initial commit
This commit is contained in:
26
src/App/Plates/NavigationExtensionFactory.php
Normal file
26
src/App/Plates/NavigationExtensionFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Plates;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Zend\Expressive\Plates\Exception\MissingHelperException;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
|
||||
class NavigationExtensionFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container) : NavigationExtension
|
||||
{
|
||||
if (! $container->has(RouterInterface::class)) {
|
||||
throw new MissingHelperException(sprintf(
|
||||
'%s requires that the %s service be present; not found',
|
||||
NavigationExtension::class,
|
||||
RouterInterface::class
|
||||
));
|
||||
}
|
||||
|
||||
$router = $container->get(RouterInterface::class);
|
||||
return new NavigationExtension($router);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user