1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
controllerbuilder.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Engine;
4
5
6use Bitrix\Main\ObjectException;
7
9{
10 public static function build(string $controllerClass, $options): Controller
11 {
12 try
13 {
14 $scope = $options['scope'] ?? Controller::SCOPE_AJAX;
15 $currentUser = $options['currentUser'] ?? CurrentUser::get();
16 $request = $options['request'] ?? null;
17
18 $reflectionClass = new \ReflectionClass($controllerClass);
19 if ($reflectionClass->isAbstract())
20 {
21 throw new ObjectException("Controller class should be non abstract.");
22 }
23
24 if (!$reflectionClass->isSubclassOf(Controller::class))
25 {
26 throw new ObjectException("Controller class should be subclass of \Bitrix\Main\Engine\Controller.");
27 }
28
32 $controller = $reflectionClass->newInstance($request);
33 $controller->setScope($scope);
34 $controller->setCurrentUser($currentUser);
35
36 return $controller;
37 }
38 catch (\ReflectionException $exception)
39 {
40 throw new ObjectException("Unable to construct controller {{$controllerClass}}.", $exception);
41 }
42 }
43}
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static get()
Определения currentuser.php:33
$options
Определения commerceml2.php:49