Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
routingconfiguration.php
1
<?php
9
namespace
Bitrix\Main\Routing
;
10
11
use
Bitrix\Main\SystemException
;
12
24
class
RoutingConfiguration
25
{
27
protected
$configurator
;
28
30
protected
$routeContainer
;
31
33
protected
$options
;
34
35
public
static
$configurationList
= [
36
'get'
,
'post'
,
'put'
,
'patch'
,
'options'
,
'delete'
,
'any'
,
'group'
37
];
38
39
public
function
__call
($method, $arguments)
40
{
41
// setting option
42
if
(in_array($method,
Options::$optionList
,
true
))
43
{
44
$this->
options
->$method(...$arguments);
45
return
$this;
46
}
47
48
throw
new
SystemException
(sprintf(
49
'Unknown method `%s` for object `%s`'
, $method, get_called_class()
50
));
51
}
52
56
public
function
setConfigurator
(
$configurator
)
57
{
58
$this->configurator =
$configurator
;
59
}
60
64
public
function
setOptions
(
$options
)
65
{
66
$this->
options
=
$options
;
67
}
68
69
public
function
get
($uri, $controller)
70
{
71
$this->
options
->methods([
'GET'
,
'HEAD'
]);
72
73
$route =
new
Route
($uri, $controller);
74
$this->routeContainer = $route;
75
76
return
$this;
77
}
78
79
public
function
post
($uri, $controller)
80
{
81
$this->
options
->methods([
'POST'
]);
82
83
$route =
new
Route
($uri, $controller);
84
$this->routeContainer = $route;
85
86
return
$this;
87
}
88
89
public
function
put
($uri, $controller)
90
{
91
$this->
options
->methods([
'PUT'
]);
92
93
$route =
new
Route
($uri, $controller);
94
$this->routeContainer = $route;
95
96
return
$this;
97
}
98
99
public
function
patch
($uri, $controller)
100
{
101
$this->
options
->methods([
'PATCH'
]);
102
103
$route =
new
Route
($uri, $controller);
104
$this->routeContainer = $route;
105
106
return
$this;
107
}
108
109
public
function
options
($uri, $controller)
110
{
111
$this->
options
->methods([
'OPTIONS'
]);
112
113
$route =
new
Route
($uri, $controller);
114
$this->routeContainer = $route;
115
116
return
$this;
117
}
118
119
public
function
delete
($uri, $controller)
120
{
121
$this->
options
->methods([
'DELETE'
]);
122
123
$route =
new
Route
($uri, $controller);
124
$this->routeContainer = $route;
125
126
return
$this;
127
}
128
129
public
function
any
($uri, $controller)
130
{
131
$route =
new
Route
($uri, $controller);
132
$this->routeContainer = $route;
133
134
return
$this;
135
}
136
137
public
function
match
($methods, $uri, $controller)
138
{
139
$this->
options
->methods($methods);
140
141
$route =
new
Route
($uri, $controller);
142
$this->routeContainer = $route;
143
144
return
$this;
145
}
146
147
public
function
group
($callback)
148
{
149
$this->routeContainer = $callback;
150
151
// add inner configuration to the router
152
$subConfigurator = clone
$this->configurator
;
153
$subConfigurator->mergeOptionsWith($this->
options
);
154
155
// call
156
$callback =
$this->routeContainer
;
157
$callback($subConfigurator);
158
}
159
160
public
function
release
()
161
{
162
$routes
= [];
163
164
if
($this->routeContainer instanceof
Route
)
165
{
166
$route =
$this->routeContainer
;
167
$route->setOptions($this->
options
);
168
169
$routes
[] = $route;
170
}
171
172
return
$routes
;
173
}
174
}
Bitrix\Main\Routing\Options\$optionList
static $optionList
Definition
options.php:18
Bitrix\Main\Routing\Route
Definition
route.php:18
Bitrix\Main\Routing\RoutingConfiguration
Definition
routingconfiguration.php:25
Bitrix\Main\Routing\RoutingConfiguration\$options
$options
Definition
routingconfiguration.php:33
Bitrix\Main\Routing\RoutingConfiguration\any
any($uri, $controller)
Definition
routingconfiguration.php:129
Bitrix\Main\Routing\RoutingConfiguration\options
options($uri, $controller)
Definition
routingconfiguration.php:109
Bitrix\Main\Routing\RoutingConfiguration\match
match($methods, $uri, $controller)
Definition
routingconfiguration.php:137
Bitrix\Main\Routing\RoutingConfiguration\group
group($callback)
Definition
routingconfiguration.php:147
Bitrix\Main\Routing\RoutingConfiguration\$configurator
$configurator
Definition
routingconfiguration.php:27
Bitrix\Main\Routing\RoutingConfiguration\put
put($uri, $controller)
Definition
routingconfiguration.php:89
Bitrix\Main\Routing\RoutingConfiguration\setOptions
setOptions($options)
Definition
routingconfiguration.php:64
Bitrix\Main\Routing\RoutingConfiguration\post
post($uri, $controller)
Definition
routingconfiguration.php:79
Bitrix\Main\Routing\RoutingConfiguration\patch
patch($uri, $controller)
Definition
routingconfiguration.php:99
Bitrix\Main\Routing\RoutingConfiguration\__call
__call($method, $arguments)
Definition
routingconfiguration.php:39
Bitrix\Main\Routing\RoutingConfiguration\release
release()
Definition
routingconfiguration.php:160
Bitrix\Main\Routing\RoutingConfiguration\$configurationList
static $configurationList
Definition
routingconfiguration.php:35
Bitrix\Main\Routing\RoutingConfiguration\$routeContainer
$routeContainer
Definition
routingconfiguration.php:30
Bitrix\Main\Routing\RoutingConfiguration\setConfigurator
setConfigurator($configurator)
Definition
routingconfiguration.php:56
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Main\Routing
Definition
_config.php:3
Bitrix\Main\Routing\$routes
$routes
Definition
_config.php:6
modules
main
lib
routing
routingconfiguration.php
Создано системой
1.10.0