__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace Slim\Routing;
use FastRoute\DataGenerator\GroupCountBased;
use FastRoute\RouteCollector as FastRouteCollector;
use FastRoute\RouteParser\Std;
use Slim\Interfaces\DispatcherInterface;
use Slim\Interfaces\RouteCollectorInterface;
class Dispatcher implements DispatcherInterface
{
private RouteCollectorInterface $routeCollector;
private ?FastRouteDispatcher $dispatcher = null;
public function __construct(RouteCollectorInterface $routeCollector)
{
$this->routeCollector = $routeCollector;
}
protected function createDispatcher(): FastRouteDispatcher
{
if ($this->dispatcher) {
return $this->dispatcher;
}
$routeDefinitionCallback = function (FastRouteCollector $r): void {
$basePath = $this->routeCollector->getBasePath();
foreach ($this->routeCollector->getRoutes() as $route) {
$r->addRoute($route->getMethods(), $basePath . $route->getPattern(), $route->getIdentifier());
}
};
$cacheFile = $this->routeCollector->getCacheFile();
if ($cacheFile) {
/** @var FastRouteDispatcher $dispatcher */
$dispatcher = \FastRoute\cachedDispatcher($routeDefinitionCallback, [
'dataGenerator' => GroupCountBased::class,
'dispatcher' => FastRouteDispatcher::class,
'routeParser' => new Std(),
'cacheFile' => $cacheFile,
]);
} else {
/** @var FastRouteDispatcher $dispatcher */
$dispatcher = \FastRoute\simpleDispatcher($routeDefinitionCallback, [
'dataGenerator' => GroupCountBased::class,
'dispatcher' => FastRouteDispatcher::class,
'routeParser' => new Std(),
]);
}
$this->dispatcher = $dispatcher;
return $this->dispatcher;
}
/**
* {@inheritdoc}
*/
public function dispatch(string $method, string $uri): RoutingResults
{
$dispatcher = $this->createDispatcher();
$results = $dispatcher->dispatch($method, $uri);
return new RoutingResults($this, $method, $uri, $results[0], $results[1], $results[2]);
}
/**
* {@inheritdoc}
*/
public function getAllowedMethods(string $uri): array
{
$dispatcher = $this->createDispatcher();
return $dispatcher->getAllowedMethods($uri);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Dispatcher.php | File | 2.41 KB | 0777 |
|
| FastRouteDispatcher.php | File | 3.1 KB | 0777 |
|
| Route.php | File | 8.82 KB | 0777 |
|
| RouteCollector.php | File | 7.47 KB | 0777 |
|
| RouteCollectorProxy.php | File | 4.52 KB | 0777 |
|
| RouteContext.php | File | 2.36 KB | 0777 |
|
| RouteGroup.php | File | 2.47 KB | 0777 |
|
| RouteParser.php | File | 3.81 KB | 0777 |
|
| RouteResolver.php | File | 1.48 KB | 0777 |
|
| RouteRunner.php | File | 2.34 KB | 0777 |
|
| RoutingResults.php | File | 2.32 KB | 0777 |
|