diff --git a/src/Loaders/CommandsLoaderTrait.php b/src/Loaders/CommandLoaderTrait.php similarity index 63% rename from src/Loaders/CommandsLoaderTrait.php rename to src/Loaders/CommandLoaderTrait.php index d3cab35f..e87cd207 100644 --- a/src/Loaders/CommandsLoaderTrait.php +++ b/src/Loaders/CommandLoaderTrait.php @@ -2,18 +2,18 @@ namespace Apiato\Core\Loaders; -use Apiato\Core\Foundation\Facades\Apiato; +use Apiato\Core\Utilities\PathHelper; use Illuminate\Support\Facades\File; -trait CommandsLoaderTrait +trait CommandLoaderTrait { - public function loadCommandsFromContainers($containerPath): void + public function loadContainerCommands($containerPath): void { $containerCommandsDirectory = $containerPath . '/UI/CLI/Commands'; - $this->loadTheConsoles($containerCommandsDirectory); + $this->loadCommands($containerCommandsDirectory); } - private function loadTheConsoles($directory): void + private function loadCommands($directory): void { if (File::isDirectory($directory)) { $files = File::allFiles($directory); @@ -21,7 +21,7 @@ private function loadTheConsoles($directory): void foreach ($files as $consoleFile) { // Do not load route files if (!$this->isRouteFile($consoleFile)) { - $consoleClass = Apiato::getClassFullNameFromFile($consoleFile->getPathname()); + $consoleClass = PathHelper::getFQCNFromFile($consoleFile->getPathname()); // When user from the Main Service Provider, which extends Laravel // service provider you get access to `$this->commands` $this->commands([$consoleClass]); @@ -35,15 +35,15 @@ private function isRouteFile($consoleFile): bool return 'closures.php' === $consoleFile->getFilename(); } - public function loadCommandsFromShip(): void + public function loadShipCommands(): void { $shipCommandsDirectory = base_path('app/Ship/Commands'); - $this->loadTheConsoles($shipCommandsDirectory); + $this->loadCommands($shipCommandsDirectory); } - public function loadCommandsFromCore(): void + public function loadCoreCommands(): void { $coreCommandsDirectory = __DIR__ . '/../Commands'; - $this->loadTheConsoles($coreCommandsDirectory); + $this->loadCommands($coreCommandsDirectory); } } diff --git a/src/Loaders/HelpersLoaderTrait.php b/src/Loaders/HelperLoaderTrait.php similarity index 84% rename from src/Loaders/HelpersLoaderTrait.php rename to src/Loaders/HelperLoaderTrait.php index 9ddb681a..15839f83 100644 --- a/src/Loaders/HelpersLoaderTrait.php +++ b/src/Loaders/HelperLoaderTrait.php @@ -5,9 +5,9 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Support\Facades\File; -trait HelpersLoaderTrait +trait HelperLoaderTrait { - public function loadHelpersFromContainers($containerPath): void + public function loadContainerHelpers($containerPath): void { $containerHelpersDirectory = $containerPath . '/Helpers'; $this->loadHelpers($containerHelpersDirectory); @@ -27,7 +27,7 @@ private function loadHelpers($helpersFolder): void } } - public function loadHelpersFromShip(): void + public function loadShipHelpers(): void { $shipHelpersDirectory = base_path('app/Ship/Helpers'); $this->loadHelpers($shipHelpersDirectory); diff --git a/src/Loaders/LocalizationLoaderTrait.php b/src/Loaders/LanguageLoaderTrait.php similarity index 88% rename from src/Loaders/LocalizationLoaderTrait.php rename to src/Loaders/LanguageLoaderTrait.php index de5d8a34..ea76dc71 100644 --- a/src/Loaders/LocalizationLoaderTrait.php +++ b/src/Loaders/LanguageLoaderTrait.php @@ -5,9 +5,9 @@ use Illuminate\Support\Facades\File; use Illuminate\Support\Str; -trait LocalizationLoaderTrait +trait LanguageLoaderTrait { - public function loadLocalsFromContainers($containerPath): void + public function loadContainerLanguages($containerPath): void { $containerLocaleDirectory = $containerPath . '/Languages'; $containerName = basename($containerPath); @@ -30,7 +30,7 @@ private function buildLocaleNamespace(string|null $sectionName, string $containe return $sectionName ? (Str::camel($sectionName) . '@' . Str::camel($containerName)) : Str::camel($containerName); } - public function loadLocalsFromShip(): void + public function loadShipLanguages(): void { $shipLocaleDirectory = base_path('app/Ship/Languages'); $this->loadLocals($shipLocaleDirectory, 'ship'); diff --git a/src/Loaders/MigrationsLoaderTrait.php b/src/Loaders/MigrationLoaderTrait.php similarity index 78% rename from src/Loaders/MigrationsLoaderTrait.php rename to src/Loaders/MigrationLoaderTrait.php index 224e2e6d..b7d58468 100644 --- a/src/Loaders/MigrationsLoaderTrait.php +++ b/src/Loaders/MigrationLoaderTrait.php @@ -4,9 +4,9 @@ use Illuminate\Support\Facades\File; -trait MigrationsLoaderTrait +trait MigrationLoaderTrait { - public function loadMigrationsFromContainers($containerPath): void + public function loadContainerMigrations($containerPath): void { $containerMigrationDirectory = $containerPath . '/Data/Migrations'; $this->loadMigrations($containerMigrationDirectory); @@ -19,7 +19,7 @@ private function loadMigrations($directory): void } } - public function loadMigrationsFromShip(): void + public function loadShipMigrations(): void { $shipMigrationDirectory = base_path('app/Ship/Migrations'); $this->loadMigrations($shipMigrationDirectory); diff --git a/src/Loaders/ViewsLoaderTrait.php b/src/Loaders/ViewLoaderTrait.php similarity index 81% rename from src/Loaders/ViewsLoaderTrait.php rename to src/Loaders/ViewLoaderTrait.php index 9cb218cc..dd1caa3b 100644 --- a/src/Loaders/ViewsLoaderTrait.php +++ b/src/Loaders/ViewLoaderTrait.php @@ -5,9 +5,9 @@ use Illuminate\Support\Facades\File; use Illuminate\Support\Str; -trait ViewsLoaderTrait +trait ViewLoaderTrait { - public function loadViewsFromContainers($containerPath): void + public function loadContainerViews($containerPath): void { $containerViewDirectory = $containerPath . '/UI/WEB/Views/'; $containerMailTemplatesDirectory = $containerPath . '/Mails/Templates/'; @@ -29,10 +29,14 @@ private function loadViews($directory, $containerName, $sectionName = null): voi private function buildViewNamespace(string|null $sectionName, string $containerName): string { - return $sectionName ? (Str::camel($sectionName) . '@' . Str::camel($containerName)) : Str::camel($containerName); + if ($sectionName) { + return Str::camel($sectionName) . '@' . Str::camel($containerName); + } + + return Str::camel($containerName); } - public function loadViewsFromShip(): void + public function loadShipViews(): void { $shipMailTemplatesDirectory = base_path('app/Ship/Mails/Templates/'); $this->loadViews($shipMailTemplatesDirectory, 'ship');