10 static private $loaded =
false;
11 static private $entities = [];
12 static private $providers = [];
13 static private $filters = [];
14 static private $extensions = [];
20 return self::$extensions;
42 if (array_key_exists(
$entityId, self::$providers))
47 $substituteEntityId =
$entity->getSubstituteEntityId();
49 is_string($substituteEntityId)
50 && isset(self::$entities[$substituteEntityId][
'substitutes'])
51 && self::$entities[$substituteEntityId][
'substitutes'] ===
$entityId
54 $moduleId = self::$entities[$substituteEntityId][
'provider'][
'moduleId'] ??
null;;
55 $className = self::$entities[$substituteEntityId][
'provider'][
'className'] ??
null;
60 $className = self::$entities[
$entityId][
'provider'][
'className'] ??
null;
82 $filterConfigs = self::$filters[
$entityId] ??
null;
83 if (!is_array($filterConfigs) ||
count($filterConfigs) === 0)
91 if (!array_key_exists($filterOption[
'id'], $filterConfigs))
97 $className = $filterConfigs[$filterOption[
'id']][
'className'] ??
null;
98 $options = isset($filterOption[
'options']) && is_array($filterOption[
'options']) ? $filterOption[
'options'] : [];
110 return self::$entities;
113 private static function load()
120 foreach (ModuleManager::getInstalledModules() as
$moduleId => $moduleDesc)
130 self::$extensions = array_merge(self::$extensions,
$settings[
'extensions']);
153 && is_string(
$filter[
'entityId'])
154 && !empty(
$filter[
'className'])
155 && is_string(
$filter[
'className'])
164 self::$loaded =
true;
167 private static function createProvider(
$moduleId, $className,
$options = []): ?BaseProvider
169 if (!is_string($className))
181 $reflectionClass = new \ReflectionClass($className);
182 if ($reflectionClass->isAbstract())
187 if (!$reflectionClass->isSubclassOf(BaseProvider::class))
198 catch (\ReflectionException $exception)
206 private static function createFilter(
$moduleId, $className,
$options = []): ?BaseFilter
208 if (!is_string($className))
220 $reflectionClass = new \ReflectionClass($className);
221 if ($reflectionClass->isAbstract())
226 if (!$reflectionClass->isSubclassOf(BaseFilter::class))
236 catch (\ReflectionException $exception)
static getInstance($moduleId=null)