blob: c73de2c24f20b450594d06f8ef95ce5190556336 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
declare(strict_types=1);
namespace Lightscale\Router;
use Lightscale\Router\Enums\HttpMethod;
class GroupDefinition
{
use Concerns\CreatesGroups;
use Concerns\CreatesRoutes;
public function __construct(
private Group $group,
) {
}
public function make(HttpMethod $method, string $path, callable $handler): RouteDefinition
{
return $this->group->getRouter()->make(
$method,
$this->group->getFullPrefix().'/'.ltrim($path, '/'),
$handler
)->inGroup($this->group);
}
private function getGroup(): Group
{
return $this->group;
}
private function getRouter(): Router
{
return $this->group->getRouter();
}
}
|