mimmi20/mezzio-navigation

View on GitHub
src/Config/NavigationConfig.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php
/**
 * This file is part of the mimmi20/mezzio-navigation package.
 *
 * Copyright (c) 2020-2024, Thomas Mueller <mimmi20@live.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types = 1);

namespace Mimmi20\Mezzio\Navigation\Config;

use Mezzio\Helper\UrlHelper;
use Mezzio\Router\RouteResult;
use Mezzio\Router\RouterInterface;
use Mimmi20\Mezzio\GenericAuthorization\AuthorizationInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
 * A simple container class for {@link \Mimmi20\Mezzio\Navigation\Page} pages
 */
final class NavigationConfig implements NavigationConfigInterface
{
    private UrlHelper | null $urlHelper                  = null;
    private RouteResult | null $routeResult              = null;
    private RouterInterface | null $router               = null;
    private ServerRequestInterface | null $request       = null;
    private AuthorizationInterface | null $authorization = null;

    /** @var array<array<string>>|null */
    private array | null $pages = null;

    /** @throws void */
    public function getUrlHelper(): UrlHelper | null
    {
        return $this->urlHelper;
    }

    /** @throws void */
    public function setUrlHelper(UrlHelper $urlHelper): void
    {
        $this->urlHelper = $urlHelper;
    }

    /** @throws void */
    public function getRouteResult(): RouteResult | null
    {
        return $this->routeResult;
    }

    /** @throws void */
    public function setRouteResult(RouteResult $routeResult): void
    {
        $this->routeResult = $routeResult;
    }

    /** @throws void */
    public function getRouter(): RouterInterface | null
    {
        return $this->router;
    }

    /** @throws void */
    public function setRouter(RouterInterface | null $router): void
    {
        $this->router = $router;
    }

    /** @throws void */
    public function getRequest(): ServerRequestInterface | null
    {
        return $this->request;
    }

    /** @throws void */
    public function setRequest(ServerRequestInterface $request): void
    {
        $this->request = $request;
    }

    /** @throws void */
    public function getAuthorization(): AuthorizationInterface | null
    {
        return $this->authorization;
    }

    /** @throws void */
    public function setAuthorization(AuthorizationInterface | null $authorization = null): void
    {
        $this->authorization = $authorization;
    }

    /**
     * @return array<array<string>>|null
     *
     * @throws void
     */
    public function getPages(): array | null
    {
        return $this->pages;
    }

    /**
     * @param array<array<string>> $pages
     *
     * @throws void
     */
    public function setPages(array $pages): void
    {
        $this->pages = $pages;
    }
}