mini\Controller\Router::compilePath()
Method
private
Signature
private function compilePath(string $path, array $params): string
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$path |
string |
required | Documentation missing |
$params |
array |
required | Documentation missing |
Returns
string
Documentation
Compile path pattern with type-aware regex
Analyzes handler parameters to determine regex patterns:
- int → \d+
- string → [^/]+
- float → \d+.?\d*
- bool → [01]|true|false
Examples: '/{id}/' + int $id → '/(?<id>\d+)/' '/{slug}/' + string $slug → '/(?<slug>[^/]+)/' '/{postId}/comments/{commentId}/' + int params → '/(?<postId>\d+)/comments/(?<commentId>\d+)/'