File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/modules/catalog/lib/eventdispatcher/eventdispatcher.php
Back
<?php namespace Bitrix\Catalog\EventDispatcher; use Bitrix\Main\Config\Configuration; use Bitrix\Rest\Event\EventBindInterface; class EventDispatcher { const SCOPE_CATALOG = 'catalog'; const MODULE_ID = 'catalog'; /** * * Handler of `rest/onRestServiceBuildDescription` event. * * @return array * @throws \ReflectionException */ public static function onRestServiceBuildDescription(): array { return (new EventDispatcher())->dispatch(); } /** * * Collect all PHP module events * * @return \array[][] * @throws \ReflectionException */ public function dispatch(): array { $bindings = []; $classes = $this->collectEntityEventBind(); foreach ($classes as $class) { $reflection = new \ReflectionClass($class); if ( !$reflection->isInterface() && !$reflection->isAbstract() && !$reflection->isTrait()) { if ($reflection->implementsInterface('\\Bitrix\\Rest\\Event\\EventBindInterface')) { $bindings += $this->getBindings($class); } } } return [ self::SCOPE_CATALOG => [ \CRestUtil::EVENTS => $bindings ] ]; } protected function collectEntityEventBind(): array { $controllersConfig = Configuration::getInstance(self::MODULE_ID); if (!$controllersConfig['controllers'] || !$controllersConfig['controllers']['restIntegration'] || !$controllersConfig['controllers']['restIntegration']['eventBind']) { return []; } return $controllersConfig['controllers']['restIntegration']['eventBind']; } /** * * Get config, handlers and bindings PHP events to REST events * * @param string|EventBindInterface $class * @return array */ public function getBindings(string $class): array { return $class::getHandlers(); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings