Commit 75862103 authored by Tino Goratsch's avatar Tino Goratsch

rename some methods within the component registry

parent e2aa6f64
......@@ -208,7 +208,7 @@ class FileResolver
private function findAssetInModules(string $moduleName, string $resourceDirectory, string $file): ?string
{
try {
$moduleAssetPath = ComponentRegistry::getPathByComponentName($moduleName) . $resourceDirectory . $file;
$moduleAssetPath = ComponentRegistry::getPathByName($moduleName) . $resourceDirectory . $file;
if (null !== ($resourcePath = $this->findAssetInStrategies($moduleAssetPath))) {
return $resourcePath;
......
......@@ -38,7 +38,7 @@ class ComponentRegistry
*
* @return ComponentDataDto[]
*/
public static function getAllComponents(): array
public static function all(): array
{
return self::$components;
}
......@@ -50,7 +50,7 @@ class ComponentRegistry
* @throws \MJS\TopSort\CircularDependencyException
* @throws \MJS\TopSort\ElementNotFoundException
*/
public static function getAllComponentsTopSorted(): array
public static function allTopSorted(): array
{
if (self::$componentsTopSorted !== null) {
return self::$componentsTopSorted;
......@@ -58,11 +58,11 @@ class ComponentRegistry
$topSort = new StringSort();
$components = self::getAllComponents();
$components = self::all();
foreach ($components as $component) {
$dependencies = \array_map(static function (string $componentName) {
$coreData = self::findComponentByName($componentName);
$coreData = self::findByName($componentName);
return $coreData ? $coreData->getPath() : null;
}, $component->getDependencies());
......@@ -83,14 +83,14 @@ class ComponentRegistry
*
* @return ComponentDataDto[]
*/
public static function filterComponentsByType(array $components, array $componentTypes): array
public static function filterByType(array $components, array $componentTypes): array
{
return \array_filter($components, static function (ComponentDataDto $component) use ($componentTypes) {
return \in_array($component->getComponentType(), $componentTypes, true);
});
}
private static function findComponentByName(string $componentName): ?ComponentDataDto
private static function findByName(string $componentName): ?ComponentDataDto
{
$componentName = \strtolower($componentName);
$filteredComponents = \array_filter(self::$components, static function (ComponentDataDto $component) use ($componentName) {
......@@ -110,9 +110,9 @@ class ComponentRegistry
*
* @throws ComponentNotFoundException
*/
public static function getPathByComponentName(string $componentName): string
public static function getPathByName(string $componentName): string
{
$component = self::findComponentByName($componentName);
$component = self::findByName($componentName);
if ($component === null) {
throw new ComponentNotFoundException(
......
......@@ -72,9 +72,9 @@ class ServiceContainerBuilder extends ContainerBuilder
$loader = new YamlFileLoader($this, new FileLocator(__DIR__));
$loader->load($this->applicationPath->getAppDir() . 'config.yml');
$loader->load(ComponentRegistry::getPathByComponentName('core') . '/Resources/config/console.yml');
$loader->load(ComponentRegistry::getPathByName('core') . '/Resources/config/console.yml');
foreach (ComponentRegistry::getAllComponentsTopSorted() as $module) {
foreach (ComponentRegistry::allTopSorted() as $module) {
$path = $module->getPath() . '/Resources/config/services.yml';
if (\is_file($path)) {
......
......@@ -93,8 +93,8 @@ class ServiceContainerBuilder extends ContainerBuilder
$loader = new YamlFileLoader($this, new FileLocator(__DIR__));
$loader->load($this->applicationPath->getAppDir() . 'config.yml');
$modules = ComponentRegistry::filterComponentsByType(
ComponentRegistry::getAllComponentsTopSorted(),
$modules = ComponentRegistry::filterByType(
ComponentRegistry::allTopSorted(),
[
ComponentTypeEnum::CORE,
ComponentTypeEnum::MODULE,
......
......@@ -65,7 +65,7 @@ class DictionaryCache implements DictionaryCacheInterface
'keys' => [],
];
foreach (ComponentRegistry::getAllComponentsTopSorted() as $module) {
foreach (ComponentRegistry::allTopSorted() as $module) {
$i18nFile = "{$module->getPath()}/Resources/i18n/{$language}.xml";
if (\is_file($i18nFile) === false) {
......@@ -144,7 +144,7 @@ class DictionaryCache implements DictionaryCacheInterface
{
$languagePacks = [];
foreach (ComponentRegistry::getAllComponents() as $component) {
foreach (ComponentRegistry::all() as $component) {
$languageFiles = \glob($component->getPath() . '/Resources/i18n/*.xml');
if ($languageFiles === false) {
......
......@@ -73,7 +73,7 @@ class ModuleInfoCache implements ModuleInfoCacheInterface
{
$infos = [];
foreach (ComponentRegistry::getAllComponents() as $module) {
foreach (ComponentRegistry::all() as $module) {
$moduleInfo = $this->fetchModuleInfo($module);
if (!empty($moduleInfo)) {
......
......@@ -93,16 +93,16 @@ class ServiceContainerBuilder extends ContainerBuilder
$this->includeCoreServices($loader);
foreach (ComponentRegistry::getAllComponentsTopSorted() as $module) {
foreach (ComponentRegistry::allTopSorted() as $module) {
$loader->load($module->getPath() . '/Resources/config/services.yml');
}
if ($this->isInstallingOrUpdating === false) {
$loader->load(ComponentRegistry::getPathByComponentName('installer') . '/Resources/config/services_overrides.yml');
$loader->load(ComponentRegistry::getPathByName('installer') . '/Resources/config/services_overrides.yml');
}
if ($this->applicationMode === ApplicationMode::UPDATER) {
$loader->load(ComponentRegistry::getPathByComponentName('installer') . '/Resources/config/services_updater.yml');
$loader->load(ComponentRegistry::getPathByName('installer') . '/Resources/config/services_updater.yml');
}
$this->compile();
......
......@@ -55,7 +55,7 @@ class ModuleInfoCache implements ModuleInfoCacheInterface
{
$infos = [];
foreach (\ACP3\Core\Component\ComponentRegistry::getAllComponents() as $module) {
foreach (\ACP3\Core\Component\ComponentRegistry::all() as $module) {
$moduleInfo = $this->fetchModuleInfo($module);
if (!empty($moduleInfo)) {
......
......@@ -47,7 +47,7 @@ class ModuleInstaller
/** @var SchemaRegistrar $schemaRegistrar */
$schemaRegistrar = $container->get('core.installer.schema_registrar');
foreach (ComponentRegistry::getAllComponentsTopSorted() as $module) {
foreach (ComponentRegistry::allTopSorted() as $module) {
$moduleConfigPath = $module->getPath() . '/Resources/config/module.xml';
if (!$this->isValidModule($moduleConfigPath)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment