style updates
This commit is contained in:
@@ -6,5 +6,6 @@ interface ModuleRegistry
|
||||
{
|
||||
/** @return array<int, array{name:string, alias:string, version:string, enabled:bool}> */
|
||||
public function all(): array;
|
||||
|
||||
public function enabled(string $name): bool;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Modules\Core\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Core\Support\ModuleInfo;
|
||||
use Modules\Core\Contracts\ModuleRegistry;
|
||||
use Modules\Core\Services\LaravelModuleRegistry;
|
||||
use Modules\Core\Support\ModuleInfo;
|
||||
|
||||
final class CoreServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Module routes are intentionally registered by each feature as it is enabled.
|
||||
|
||||
@@ -21,14 +21,18 @@ final class LaravelModuleRegistry implements ModuleRegistry
|
||||
];
|
||||
}
|
||||
usort($modules, fn (array $a, array $b): int => $a['name'] <=> $b['name']);
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
public function enabled(string $name): bool
|
||||
{
|
||||
foreach ($this->all() as $module) {
|
||||
if (strcasecmp($module['name'], $name) === 0) return $module['enabled'];
|
||||
if (strcasecmp($module['name'], $name) === 0) {
|
||||
return $module['enabled'];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@ namespace Modules\Core\Support;
|
||||
|
||||
final class ModuleInfo
|
||||
{
|
||||
public static function name(): string { return 'Core'; }
|
||||
public static function nameLower(): string { return 'core'; }
|
||||
public static function name(): string
|
||||
{
|
||||
return 'Core';
|
||||
}
|
||||
|
||||
public static function nameLower(): string
|
||||
{
|
||||
return 'core';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user