403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/routing/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/routing/routingconfiguration.php
<?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;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit