Upstream nikic/FastRoute state of the touched files before 8bb83fe8c2
This commit is contained in:
commit
c0905f9089
6 files changed
+720
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FastRoute\Dispatcher;
|
||||
|
||||
use FastRoute\Dispatcher\Result\Matched;
|
||||
|
||||
use function count;
|
||||
use function preg_match;
|
||||
|
||||
/** @final */
|
||||
class GroupCountBased extends RegexBasedAbstract
|
||||
{
|
||||
/** @inheritDoc */
|
||||
protected function dispatchVariableRoute(array $routeData, string $uri): ?Matched
|
||||
{
|
||||
foreach ($routeData as $data) {
|
||||
if (preg_match($data['regex'], $uri, $matches) !== 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
[$handler, $varNames, $extraParameters] = $data['routeMap'][count($matches)];
|
||||
|
||||
$vars = [];
|
||||
$i = 0;
|
||||
foreach ($varNames as $varName) {
|
||||
$vars[$varName] = $matches[++$i];
|
||||
}
|
||||
|
||||
$result = new Matched();
|
||||
$result->handler = $handler;
|
||||
$result->variables = $vars;
|
||||
$result->extraParameters = $extraParameters;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user