Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
CatalogRuleFactory.php
1<?php
2
4
8
10{
11 protected const BASE_RULE = 'Base';
12
13 protected function getClassName(string $action, AccessibleController $controller): ?string
14 {
15 $actionName = ActionDictionary::getActionRuleName($action);
16 if (!$actionName)
17 {
18 return null;
19 }
20
21 $action = explode('_', $actionName);
22 $action = array_map(fn($el) => ucfirst(mb_strtolower($el)), $action);
23
24 $ruleClass = $this->getNamespace($controller) . implode($action) . static::SUFFIX;
25
26 if (class_exists($ruleClass))
27 {
28 return $ruleClass;
29 }
30
31 return $this->getNamespace($controller) . static::BASE_RULE . static::SUFFIX;
32 }
33}
getClassName(string $action, AccessibleController $controller)