Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsam726 authored and github-actions[bot] committed Apr 13, 2024
1 parent 2561e68 commit 9082a6a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Commands/ModulesFilamentInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function getModule(): \Nwidart\Modules\Module
{
try {
return Module::findOrFail($this->moduleName);
} catch (ModuleNotFoundException|\Throwable $exception) {
} catch (ModuleNotFoundException | \Throwable $exception) {
if (confirm("Module $this->moduleName does not exist. Would you like to generate it?", true)) {
$this->call('module:make', ['name' => [$this->moduleName]]);

Expand Down
4 changes: 2 additions & 2 deletions src/Concerns/CanManipulateFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function checkForCollision(array $paths): bool
continue;
}

if (! confirm(basename($path).' already exists, do you want to overwrite it?')) {
if (! confirm(basename($path) . ' already exists, do you want to overwrite it?')) {
$this->components->error("{$path} already exists, aborting.");

return true;
Expand All @@ -39,7 +39,7 @@ protected function copyStubToApp(string $stub, string $targetPath, array $replac
{
$filesystem = app(Filesystem::class);

$stubPath = $this->getDefaultStubPath()."/{$stub}.stub";
$stubPath = $this->getDefaultStubPath() . "/{$stub}.stub";

$stub = str($filesystem->get($stubPath));

Expand Down
10 changes: 5 additions & 5 deletions src/Concerns/GeneratesModularFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getArguments(): array

protected function resolveStubPath($stub): string
{
return FilamentModules::packagePath('src/Commands/'.trim($stub, DIRECTORY_SEPARATOR));
return FilamentModules::packagePath('src/Commands/' . trim($stub, DIRECTORY_SEPARATOR));
}

public function getModule(): Module
Expand All @@ -29,7 +29,7 @@ public function getModule(): Module

protected function getDefaultNamespace($rootNamespace): string
{
return trim($rootNamespace, '\\').'\\'.trim(Str::replace(DIRECTORY_SEPARATOR, '\\', $this->getRelativeNamespace()), '\\');
return trim($rootNamespace, '\\') . '\\' . trim(Str::replace(DIRECTORY_SEPARATOR, '\\', $this->getRelativeNamespace()), '\\');
}

abstract protected function getRelativeNamespace(): string;
Expand All @@ -43,7 +43,7 @@ protected function getPath($name): string
{
$name = Str::replaceFirst($this->rootNamespace(), '', $name);

return $this->getModule()->getExtraPath(str_replace('\\', '/', $name).'.php');
return $this->getModule()->getExtraPath(str_replace('\\', '/', $name) . '.php');
}

protected function possibleModels()
Expand All @@ -61,7 +61,7 @@ protected function viewPath($path = ''): string
{
$views = $this->getModule()->resourcesPath('views');

return $views.($path ? DIRECTORY_SEPARATOR.$path : $path);
return $views . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}

protected function buildClass($name)
Expand Down Expand Up @@ -89,7 +89,7 @@ protected function promptForMissingArgumentsUsing(): array
{
return [
'name' => [
'What should the '.strtolower($this->type ?: 'class').' be named?',
'What should the ' . strtolower($this->type ?: 'class') . ' be named?',
match ($this->type) {
'Cast' => 'E.g. Json',
'Channel' => 'E.g. OrderChannel',
Expand Down
2 changes: 1 addition & 1 deletion src/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function execCommand(string $command, ?Command $artisan = null): void
public function packagePath(string $path = ''): string
{
//return the base path of this package
return dirname(__DIR__.'../').($path ? DIRECTORY_SEPARATOR.trim($path, DIRECTORY_SEPARATOR) : '');
return dirname(__DIR__ . '../') . ($path ? DIRECTORY_SEPARATOR . trim($path, DIRECTORY_SEPARATOR) : '');
}
}
2 changes: 1 addition & 1 deletion src/ModulesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function getModulePlugins(): array
}
// get a glob of all Filament plugins
$basePath = str(config('modules.paths.modules', 'Modules'));
$pattern = $basePath.'/*/App/Filament/*Plugin.php';
$pattern = $basePath . '/*/App/Filament/*Plugin.php';
$pluginPaths = glob($pattern);

return collect($pluginPaths)->map(fn ($path) => FilamentModules::convertPathToNamespace($path))->toArray();
Expand Down
16 changes: 8 additions & 8 deletions src/ModulesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function packageBooted(): void

// Handle Stubs
if (app()->runningInConsole()) {
foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) {
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
$this->publishes([
$file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"),
], 'modules-stubs');
Expand Down Expand Up @@ -167,44 +167,44 @@ protected function registerModuleMacros(): void
$relativeNamespace = str_replace('App\\', '', $relativeNamespace);
$relativeNamespace = str_replace('App', '', $relativeNamespace);
$relativeNamespace = trim($relativeNamespace, '\\');
$relativeNamespace = 'App\\'.$relativeNamespace;
$relativeNamespace = 'App\\' . $relativeNamespace;

return $this->namespace($relativeNamespace);
});
Module::macro('appPath', function (string $relativePath = '') {
$appPath = $this->getExtraPath('App');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});

Module::macro('databasePath', function (string $relativePath = '') {
$appPath = $this->getExtraPath('Database');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});

Module::macro('resourcesPath', function (string $relativePath = '') {
$appPath = $this->getExtraPath('resources');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});

Module::macro('migrationsPath', function (string $relativePath = '') {
$appPath = $this->databasePath('migrations');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});

Module::macro('seedersPath', function (string $relativePath = '') {
$appPath = $this->databasePath('Seeders');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});

Module::macro('factoriesPath', function (string $relativePath = '') {
$appPath = $this->databasePath('Factories');

return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
});
}
}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
use BladeUI\Icons\BladeIconsServiceProvider;
use Coolsam\Modules\ModulesServiceProvider;
use Filament\Actions\ActionsServiceProvider;
use Filament\FilamentServiceProvider;
use Filament\Forms\FormsServiceProvider;
Expand All @@ -16,7 +17,6 @@
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider;
use Coolsam\Modules\ModulesServiceProvider;

class TestCase extends Orchestra
{
Expand Down

0 comments on commit 9082a6a

Please sign in to comment.