27 lines
733 B
PHP
27 lines
733 B
PHP
<?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);
|
|
}
|
|
}
|