20 lines
435 B
PHP
20 lines
435 B
PHP
|
|
<?php
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Phred\Http\Routing;
|
||
|
|
|
||
|
|
use Phred\Http\Router;
|
||
|
|
|
||
|
|
final class RouteGroups
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Include a set of routes under a prefix using the provided Router instance.
|
||
|
|
*/
|
||
|
|
public static function include(Router $router, string $prefix, callable $loader): void
|
||
|
|
{
|
||
|
|
$router->group($prefix, static function (Router $r) use ($loader): void {
|
||
|
|
$loader($r);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|