@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Nwidart\Modules\FileRepository; |
| 7 | 7 | use Nwidart\Modules\Module; |
| 8 | 8 | |
| 9 | -if (! function_exists('module')) { |
|
| 9 | +if (!function_exists('module')) { |
|
| 10 | 10 | /** |
| 11 | 11 | * Retrieves a module status or its instance. |
| 12 | 12 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * @param bool $instance Whether to return the module's instance instead of the status. Defaults to false [status]. |
| 15 | 15 | * @return bool|Module The module instance or its status. |
| 16 | 16 | */ |
| 17 | - function module(string $name, bool $instance = false): bool|Module |
|
| 17 | + function module(string $name, bool $instance = false): bool | Module |
|
| 18 | 18 | { |
| 19 | 19 | /** @var FileRepository $repository */ |
| 20 | 20 | $repository = app('modules'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if (! function_exists('module_path')) { |
|
| 32 | +if (!function_exists('module_path')) { |
|
| 33 | 33 | function module_path(string $name, string $path = ''): string |
| 34 | 34 | { |
| 35 | 35 | $module = app('modules')->find($name); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if (! function_exists('config_path')) { |
|
| 41 | +if (!function_exists('config_path')) { |
|
| 42 | 42 | /** |
| 43 | 43 | * Get the configuration path. |
| 44 | 44 | */ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (! function_exists('public_path')) { |
|
| 51 | +if (!function_exists('public_path')) { |
|
| 52 | 52 | /** |
| 53 | 53 | * Get the path to the public folder. |
| 54 | 54 | */ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -if (! function_exists('module_vite')) { |
|
| 61 | +if (!function_exists('module_vite')) { |
|
| 62 | 62 | /** |
| 63 | 63 | * support for vite |
| 64 | 64 | */ |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $groupedCommands = []; |
| 30 | 30 | foreach ($commands as $command) { |
| 31 | 31 | $directory = $this->getDirectoryFromNamespace($command['namespace']); |
| 32 | - if (! isset($groupedCommands[$directory])) { |
|
| 32 | + if (!isset($groupedCommands[$directory])) { |
|
| 33 | 33 | $groupedCommands[$directory] = []; |
| 34 | 34 | } |
| 35 | 35 | $groupedCommands[$directory][] = $command; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | 71 | foreach ($possiblePaths as $path) { |
| 72 | - if (! is_dir($path)) { |
|
| 72 | + if (!is_dir($path)) { |
|
| 73 | 73 | continue; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | // Extract the short class name from the fully qualified class name |
| 136 | 136 | $shortClassName = $this->getShortClassName($className); |
| 137 | 137 | |
| 138 | - if (! class_exists($className)) { |
|
| 138 | + if (!class_exists($className)) { |
|
| 139 | 139 | return [ |
| 140 | 140 | 'class' => $className, |
| 141 | 141 | 'name' => $shortClassName, |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | $reflection = new ReflectionClass($className); |
| 147 | 147 | |
| 148 | 148 | // Skip if not a command class |
| 149 | - if (! $reflection->isSubclassOf(SymfonyCommand::class) && |
|
| 150 | - ! $reflection->isSubclassOf('Illuminate\Console\Command')) { |
|
| 149 | + if (!$reflection->isSubclassOf(SymfonyCommand::class) && |
|
| 150 | + !$reflection->isSubclassOf('Illuminate\Console\Command')) { |
|
| 151 | 151 | return null; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Skip if the class is not instantiable or has required constructor parameters |
| 155 | - if (! $reflection->isInstantiable() || $reflection->getConstructor()?->getNumberOfRequiredParameters() > 0) { |
|
| 155 | + if (!$reflection->isInstantiable() || $reflection->getConstructor()?->getNumberOfRequiredParameters() > 0) { |
|
| 156 | 156 | return [ |
| 157 | 157 | 'class' => $className, |
| 158 | 158 | 'name' => $shortClassName, |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | $phpunitXmlPath = base_path('phpunit.xml'); |
| 32 | 32 | $modulesStatusPath = config('modules.activators.file.statuses-file', base_path('modules_statuses.json')); |
| 33 | 33 | |
| 34 | - if (! file_exists($phpunitXmlPath)) { |
|
| 34 | + if (!file_exists($phpunitXmlPath)) { |
|
| 35 | 35 | $this->error("phpunit.xml file not found: {$phpunitXmlPath}"); |
| 36 | 36 | |
| 37 | 37 | return 100; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if (! file_exists($modulesStatusPath)) { |
|
| 40 | + if (!file_exists($modulesStatusPath)) { |
|
| 41 | 41 | $this->error("Modules statuses file not found: {$modulesStatusPath}"); |
| 42 | 42 | |
| 43 | 43 | return 99; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return 'Application In Production'; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function getConfirmableCallback(): \Closure|bool|null |
|
| 68 | + public function getConfirmableCallback(): \Closure | bool | null |
|
| 69 | 69 | { |
| 70 | 70 | return null; |
| 71 | 71 | } |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | if ($this instanceof ConfirmableCommand) { |
| 79 | 79 | if ( |
| 80 | 80 | $this->isProhibited() || |
| 81 | - ! $this->confirmToProceed($this->getConfirmableLabel(), $this->getConfirmableCallback()) |
|
| 81 | + !$this->confirmToProceed($this->getConfirmableLabel(), $this->getConfirmableCallback()) |
|
| 82 | 82 | ) { |
| 83 | 83 | return Command::FAILURE; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if (! is_null($info = $this->getInfo())) { |
|
| 87 | + if (!is_null($info = $this->getInfo())) { |
|
| 88 | 88 | $this->components->info($info); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (! empty($input->getArgument('module'))) { |
|
| 110 | + if (!empty($input->getArgument('module'))) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $selected_item = multisearch( |
| 115 | 115 | label: 'Select Modules', |
| 116 | - options: function (string $search_value) use ($modules) { |
|
| 116 | + options: function(string $search_value) use ($modules) { |
|
| 117 | 117 | return collect([ |
| 118 | 118 | self::ALL, |
| 119 | 119 | ...$modules, |
| 120 | - ])->when(strlen($search_value) > 0, function (Collection &$modules) use ($search_value) { |
|
| 120 | + ])->when(strlen($search_value) > 0, function(Collection & $modules) use ($search_value) { |
|
| 121 | 121 | return $modules->filter(fn ($item) => str_contains(strtolower($item), strtolower($search_value))); |
| 122 | 122 | })->values()->toArray(); |
| 123 | 123 | }, |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $sort = $this->option('direction') ?? 'asc'; |
| 155 | 155 | |
| 156 | - if (! is_string($statusesFile) || ! file_exists($statusesFile)) { |
|
| 156 | + if (!is_string($statusesFile) || !file_exists($statusesFile)) { |
|
| 157 | 157 | return array_keys($this->laravel['modules']->getOrdered($sort)); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $json = @file_get_contents($statusesFile); |
| 161 | 161 | $data = is_string($json) ? json_decode($json, true) : null; |
| 162 | 162 | |
| 163 | - if (! is_array($data)) { |
|
| 163 | + if (!is_array($data)) { |
|
| 164 | 164 | return array_keys($this->laravel['modules']->getOrdered($sort)); |
| 165 | 165 | } |
| 166 | 166 | |