<?php
/*
 * This file is part of the Harmony package.
 *
 * (c) Tim Goudriaan <tim@harmony-project.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Harmony\Component\ModularRouting\Provider;

use Harmony\Component\ModularRouting\Model\ModuleInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RouteCollection;

/**
 * ProviderInterface
 *
 * Returns RouteCollection objects for Module instances.
 *
 * @author Tim Goudriaan <tim@harmony-project.io>
 */
interface ProviderInterface
{
    /**
     * Returns the route collection associated with a module
     *
     * @param ModuleInterface|int $module Module object or id
     *
     * @return RouteCollection
     * @throws RouteNotFoundException If the module doesn't exist
     */
    public function getRouteCollectionByModule($module);

    /**
     * Returns the route collection associated with a request
     *
     * Required parameters:
     *
     *   * _modular_segment: Segment of path to use to match the request against
     *                       a module.
     *
     * @param Request $request    The request
     * @param array   $parameters Parameters returned by an UrlMatcher
     *
     * @return RouteCollection
     */
    public function getRouteCollectionForRequest(Request $request, array $parameters = []);
}

Create an interface for Provider objects
Create an interface for Provider objects
