diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index d1ce5c00e..a16f38176 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -16,7 +16,7 @@ class AppSettingsCommand extends Command $path = base_path('.env'); if (!file_exists($path)) { $this->comment('Copying example .env file'); - copy($path.'.example', $path); + copy($path . '.example', $path); } if (!config('app.key')) { diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index a1ec5f7c2..87c8186c1 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -44,7 +44,7 @@ class EmailSettingsCommand extends Command env('MAIL_MAILER', env('MAIL_DRIVER', 'smtp')), ); - $method = 'setup'.studly_case($this->variables['MAIL_MAILER']).'DriverVariables'; + $method = 'setup' . studly_case($this->variables['MAIL_MAILER']) . 'DriverVariables'; if (method_exists($this, $method)) { $this->{$method}(); } diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index 83266155b..dbf1aa735 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -19,7 +19,7 @@ class QueueWorkerServiceCommand extends Command public function handle(): void { $serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue'); - $path = '/etc/systemd/system/'.$serviceName.'.service'; + $path = '/etc/systemd/system/' . $serviceName . '.service'; $fileExists = file_exists($path); if ($fileExists && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { @@ -65,7 +65,7 @@ WantedBy=multi-user.target if ($fileExists) { $result = Process::run("systemctl restart $serviceName.service"); if ($result->failed()) { - $this->error('Error restarting service: '.$result->errorOutput()); + $this->error('Error restarting service: ' . $result->errorOutput()); return; } @@ -74,7 +74,7 @@ WantedBy=multi-user.target } else { $result = Process::run("systemctl enable --now $serviceName.service"); if ($result->failed()) { - $this->error('Error enabling service: '.$result->errorOutput()); + $this->error('Error enabling service: ' . $result->errorOutput()); return; } diff --git a/app/Console/Commands/Maintenance/PruneImagesCommand.php b/app/Console/Commands/Maintenance/PruneImagesCommand.php index a2f8c36ce..23f613fa3 100644 --- a/app/Console/Commands/Maintenance/PruneImagesCommand.php +++ b/app/Console/Commands/Maintenance/PruneImagesCommand.php @@ -50,7 +50,7 @@ class PruneImagesCommand extends Command $count = count($response['ImagesDeleted']); $useBinaryPrefix = config('panel.use_binary_prefix'); - $space = round($useBinaryPrefix ? $response['SpaceReclaimed'] / 1024 / 1024 : $response['SpaceReclaimed'] / 1000 / 1000, 2).($useBinaryPrefix ? ' MiB' : ' MB'); + $space = round($useBinaryPrefix ? $response['SpaceReclaimed'] / 1024 / 1024 : $response['SpaceReclaimed'] / 1000 / 1000, 2) . ($useBinaryPrefix ? ' MiB' : ' MB'); $this->info("Node {$node->id}: Cleaned up {$count} dangling docker images. ({$space})"); } catch (Exception $exception) { diff --git a/app/Console/Commands/Schedule/ProcessRunnableCommand.php b/app/Console/Commands/Schedule/ProcessRunnableCommand.php index 67ee89f3d..d1d71ae02 100644 --- a/app/Console/Commands/Schedule/ProcessRunnableCommand.php +++ b/app/Console/Commands/Schedule/ProcessRunnableCommand.php @@ -67,7 +67,7 @@ class ProcessRunnableCommand extends Command } catch (\Throwable|\Exception $exception) { logger()->error($exception, ['schedule_id' => $schedule->id]); - $this->error(__('commands.schedule.process.no_tasks')." #$schedule->id: ".$exception->getMessage()); + $this->error(__('commands.schedule.process.no_tasks') . " #$schedule->id: " . $exception->getMessage()); } } } diff --git a/app/Console/Commands/UpgradeCommand.php b/app/Console/Commands/UpgradeCommand.php index 8f97d6dd3..75a3c185f 100644 --- a/app/Console/Commands/UpgradeCommand.php +++ b/app/Console/Commands/UpgradeCommand.php @@ -40,7 +40,7 @@ class UpgradeCommand extends Command } if (version_compare(PHP_VERSION, '7.4.0') < 0) { - $this->error(__('commands.upgrade.php_version').' ['.PHP_VERSION.'].'); + $this->error(__('commands.upgrade.php_version') . ' [' . PHP_VERSION . '].'); } $user = 'www-data'; @@ -125,7 +125,7 @@ class UpgradeCommand extends Command $command[] = '--no-dev'; } - $this->line('$upgrader> '.implode(' ', $command)); + $this->line('$upgrader> ' . implode(' ', $command)); $process = new Process($command); $process->setTimeout(10 * 60); $process->run(function ($type, $buffer) { @@ -134,7 +134,7 @@ class UpgradeCommand extends Command }); /** @var \Illuminate\Foundation\Application $app */ - $app = require __DIR__.'/../../../bootstrap/app.php'; + $app = require __DIR__ . '/../../../bootstrap/app.php'; /** @var \App\Console\Kernel $kernel */ $kernel = $app->make(Kernel::class); $kernel->bootstrap(); @@ -192,6 +192,6 @@ class UpgradeCommand extends Command return $this->option('url'); } - return sprintf(self::DEFAULT_URL, $this->option('release') ? 'download/v'.$this->option('release') : 'latest/download'); + return sprintf(self::DEFAULT_URL, $this->option('release') ? 'download/v' . $this->option('release') : 'latest/download'); } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index f4a17cefc..3c2fc96fa 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel */ protected function commands(): void { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); } /** diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f3bc40cd3..6327a214c 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -108,7 +108,7 @@ class Handler extends ExceptionHandler $exception->getLine() ); - return $message."\nStack trace:\n".trim($cleanedStack); + return $message . "\nStack trace:\n" . trim($cleanedStack); } /** @@ -160,7 +160,7 @@ class Handler extends ExceptionHandler 'source_field' => $field, 'rule' => str_replace(self::PANEL_RULE_STRING, 'p_', Arr::get( $codes, - str_replace('.', '_', $field).'.'.$key + str_replace('.', '_', $field) . '.' . $key )), ]; diff --git a/app/Extensions/Backups/BackupManager.php b/app/Extensions/Backups/BackupManager.php index 16c704b97..9922a55c6 100644 --- a/app/Extensions/Backups/BackupManager.php +++ b/app/Extensions/Backups/BackupManager.php @@ -74,7 +74,7 @@ class BackupManager return $this->callCustomCreator($config); } - $adapterMethod = 'create'.Str::studly($adapter).'Adapter'; + $adapterMethod = 'create' . Str::studly($adapter) . 'Adapter'; if (method_exists($this, $adapterMethod)) { $instance = $this->{$adapterMethod}($config); diff --git a/app/Extensions/DynamicDatabaseConnection.php b/app/Extensions/DynamicDatabaseConnection.php index b4409ed4b..147f78064 100644 --- a/app/Extensions/DynamicDatabaseConnection.php +++ b/app/Extensions/DynamicDatabaseConnection.php @@ -21,7 +21,7 @@ class DynamicDatabaseConnection $host = DatabaseHost::query()->findOrFail($host); } - config()->set('database.connections.'.$connection, [ + config()->set('database.connections.' . $connection, [ 'driver' => self::DB_DRIVER, 'host' => $host->host, 'port' => $host->port, diff --git a/app/Extensions/Themes/Theme.php b/app/Extensions/Themes/Theme.php index 92b587fb7..2badc3dcb 100644 --- a/app/Extensions/Themes/Theme.php +++ b/app/Extensions/Themes/Theme.php @@ -6,16 +6,16 @@ class Theme { public function js($path): string { - return sprintf(''.PHP_EOL, $this->getUrl($path)); + return sprintf('' . PHP_EOL, $this->getUrl($path)); } public function css($path): string { - return sprintf(''.PHP_EOL, $this->getUrl($path)); + return sprintf('' . PHP_EOL, $this->getUrl($path)); } protected function getUrl($path): string { - return '/themes/panel/'.ltrim($path, '/'); + return '/themes/panel/' . ltrim($path, '/'); } } diff --git a/app/Filament/Pages/Installer/Steps/CompletedStep.php b/app/Filament/Pages/Installer/Steps/CompletedStep.php index 8b91c7686..50f9a780c 100644 --- a/app/Filament/Pages/Installer/Steps/CompletedStep.php +++ b/app/Filament/Pages/Installer/Steps/CompletedStep.php @@ -21,12 +21,12 @@ class CompletedStep ->label(new HtmlString('Run the following command to setup your crontab. Note that www-data is your webserver user. On some systems this username might be different!')) ->disabled() ->hintAction(CopyAction::make()) - ->default('(crontab -l -u www-data 2>/dev/null; echo "* * * * * php '.base_path().'/artisan schedule:run >> /dev/null 2>&1") | crontab -u www-data -'), + ->default('(crontab -l -u www-data 2>/dev/null; echo "* * * * * php ' . base_path() . '/artisan schedule:run >> /dev/null 2>&1") | crontab -u www-data -'), TextInput::make('queueService') ->label(new HtmlString('To setup the queue worker service you simply have to run the following command.')) ->disabled() ->hintAction(CopyAction::make()) - ->default('sudo php '.base_path().'/artisan p:environment:queue-service'), + ->default('sudo php ' . base_path() . '/artisan p:environment:queue-service'), Placeholder::make('') ->content('After you finished these two last tasks you can click on "Finish" and use your new panel! Have fun!'), ]); diff --git a/app/Filament/Pages/Installer/Steps/RequirementsStep.php b/app/Filament/Pages/Installer/Steps/RequirementsStep.php index d2afd4b37..5e6d6988d 100644 --- a/app/Filament/Pages/Installer/Steps/RequirementsStep.php +++ b/app/Filament/Pages/Installer/Steps/RequirementsStep.php @@ -18,12 +18,12 @@ class RequirementsStep $fields = [ Section::make('PHP Version') - ->description(self::MIN_PHP_VERSION.' or newer') + ->description(self::MIN_PHP_VERSION . ' or newer') ->icon($correctPhpVersion ? 'tabler-check' : 'tabler-x') ->iconColor($correctPhpVersion ? 'success' : 'danger') ->schema([ Placeholder::make('') - ->content('Your PHP Version is '.PHP_VERSION.'.'), + ->content('Your PHP Version is ' . PHP_VERSION . '.'), ]), ]; @@ -49,7 +49,7 @@ class RequirementsStep ->content('All needed PHP Extensions are installed.') ->visible($allExtensionsInstalled), Placeholder::make('') - ->content('The following PHP Extensions are missing: '.implode(', ', array_keys($phpExtensions, false))) + ->content('The following PHP Extensions are missing: ' . implode(', ', array_keys($phpExtensions, false))) ->visible(!$allExtensionsInstalled), ]); @@ -68,7 +68,7 @@ class RequirementsStep ->content('All Folders have the correct permissions.') ->visible($correctFolderPermissions), Placeholder::make('') - ->content('The following Folders have wrong permissions: '.implode(', ', array_keys($folderPermissions, false))) + ->content('The following Folders have wrong permissions: ' . implode(', ', array_keys($folderPermissions, false))) ->visible(!$correctFolderPermissions), ]); diff --git a/app/Filament/Resources/ApiKeyResource/Pages/ListApiKeys.php b/app/Filament/Resources/ApiKeyResource/Pages/ListApiKeys.php index 8ef0cdd3c..aa0b9cdb5 100644 --- a/app/Filament/Resources/ApiKeyResource/Pages/ListApiKeys.php +++ b/app/Filament/Resources/ApiKeyResource/Pages/ListApiKeys.php @@ -24,7 +24,7 @@ class ListApiKeys extends ListRecords TextColumn::make('key') ->copyable() ->icon('tabler-clipboard-text') - ->state(fn (ApiKey $key) => $key->identifier.$key->token), + ->state(fn (ApiKey $key) => $key->identifier . $key->token), TextColumn::make('memo') ->label('Description') diff --git a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php index 3b209d7f7..13b32602f 100644 --- a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php +++ b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php @@ -37,7 +37,7 @@ class DatabasesRelationManager extends RelationManager TextInput::make('JDBC') ->label('JDBC Connection String') ->columnSpanFull() - ->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://'.$get('username').':'.urlencode($database->password).'@'.$database->host->host.':'.$database->host->port.'/'.$get('database')), + ->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($database->password) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database')), ]); } @@ -64,7 +64,7 @@ class DatabasesRelationManager extends RelationManager protected function rotatePassword(DatabasePasswordService $service, Database $database, $set, $get): void { $newPassword = $service->handle($database); - $jdbcString = 'jdbc:mysql://'.$get('username').':'.urlencode($newPassword).'@'.$database->host->host.':'.$database->host->port.'/'.$get('database'); + $jdbcString = 'jdbc:mysql://' . $get('username') . ':' . urlencode($newPassword) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database'); $set('password', $newPassword); $set('JDBC', $jdbcString); diff --git a/app/Filament/Resources/EggResource/Pages/EditEgg.php b/app/Filament/Resources/EggResource/Pages/EditEgg.php index b9b839cb1..d1d59c064 100644 --- a/app/Filament/Resources/EggResource/Pages/EditEgg.php +++ b/app/Filament/Resources/EggResource/Pages/EditEgg.php @@ -249,7 +249,7 @@ class EditEgg extends EditRecord ->color('primary') ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { echo $service->handle($egg->id); - }, 'egg-'.$egg->getKebabName().'.json')) + }, 'egg-' . $egg->getKebabName() . '.json')) ->authorize(fn () => auth()->user()->can('export egg')), Actions\Action::make('importEgg') ->label('Import') diff --git a/app/Filament/Resources/EggResource/Pages/ListEggs.php b/app/Filament/Resources/EggResource/Pages/ListEggs.php index 0903379e5..a7f84b274 100644 --- a/app/Filament/Resources/EggResource/Pages/ListEggs.php +++ b/app/Filament/Resources/EggResource/Pages/ListEggs.php @@ -55,7 +55,7 @@ class ListEggs extends ListRecords ->color('primary') ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { echo $service->handle($egg->id); - }, 'egg-'.$egg->getKebabName().'.json')) + }, 'egg-' . $egg->getKebabName() . '.json')) ->authorize(fn () => auth()->user()->can('export egg')), Action::make('update') ->icon('tabler-cloud-download') diff --git a/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php b/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php index 78119aaf5..89d1cb254 100644 --- a/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php +++ b/app/Filament/Resources/NodeResource/Widgets/NodeCpuChart.php @@ -76,8 +76,8 @@ class NodeCpuChart extends ChartWidget $threads = $node->systemInformation()['cpu_count'] ?? 0; $cpu = Number::format(collect(cache()->get("nodes.$node->id.cpu_percent"))->last() * $threads, maxPrecision: 2, locale: auth()->user()->language); - $max = Number::format($threads * 100, locale: auth()->user()->language).'%'; + $max = Number::format($threads * 100, locale: auth()->user()->language) . '%'; - return 'CPU - '.$cpu.'% Of '.$max; + return 'CPU - ' . $cpu . '% Of ' . $max; } } diff --git a/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php b/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php index e1c19099b..0cabbed51 100644 --- a/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php +++ b/app/Filament/Resources/NodeResource/Widgets/NodeMemoryChart.php @@ -75,13 +75,13 @@ class NodeMemoryChart extends ChartWidget $totalMemory = collect(cache()->get("nodes.$node->id.memory_total"))->last(); $used = config('panel.use_binary_prefix') - ? Number::format($latestMemoryUsed / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language).' GiB' - : Number::format($latestMemoryUsed / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language).' GB'; + ? Number::format($latestMemoryUsed / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB' + : Number::format($latestMemoryUsed / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB'; $total = config('panel.use_binary_prefix') - ? Number::format($totalMemory / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language).' GiB' - : Number::format($totalMemory / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language).' GB'; + ? Number::format($totalMemory / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB' + : Number::format($totalMemory / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB'; - return 'Memory - '.$used.' Of '.$total; + return 'Memory - ' . $used . ' Of ' . $total; } } diff --git a/app/Filament/Resources/RoleResource.php b/app/Filament/Resources/RoleResource.php index 898090222..306c9676d 100644 --- a/app/Filament/Resources/RoleResource.php +++ b/app/Filament/Resources/RoleResource.php @@ -40,12 +40,12 @@ class RoleResource extends Resource $options = []; foreach (RolePermissionPrefixes::cases() as $prefix) { - $options[$prefix->value.' '.strtolower($model->value)] = Str::headline($prefix->value); + $options[$prefix->value . ' ' . strtolower($model->value)] = Str::headline($prefix->value); } if (array_key_exists($model->value, Role::MODEL_SPECIFIC_PERMISSIONS)) { foreach (Role::MODEL_SPECIFIC_PERMISSIONS[$model->value] as $permission) { - $options[$permission.' '.strtolower($model->value)] = Str::headline($permission); + $options[$permission . ' ' . strtolower($model->value)] = Str::headline($permission); } } @@ -56,7 +56,7 @@ class RoleResource extends Resource $options = []; foreach ($prefixes as $prefix) { - $options[$prefix.' '.strtolower($model)] = Str::headline($prefix); + $options[$prefix . ' ' . strtolower($model)] = Str::headline($prefix); } $permissions[] = self::makeSection($model, $options); @@ -88,10 +88,10 @@ class RoleResource extends Resource { $icon = null; - if (class_exists('\App\Filament\Resources\\'.$model.'Resource')) { - $icon = ('\App\Filament\Resources\\'.$model.'Resource')::getNavigationIcon(); - } elseif (class_exists('\App\Filament\Pages\\'.$model)) { - $icon = ('\App\Filament\Pages\\'.$model)::getNavigationIcon(); + if (class_exists('\App\Filament\Resources\\' . $model . 'Resource')) { + $icon = ('\App\Filament\Resources\\' . $model . 'Resource')::getNavigationIcon(); + } elseif (class_exists('\App\Filament\Pages\\' . $model)) { + $icon = ('\App\Filament\Pages\\' . $model)::getNavigationIcon(); } return Section::make(Str::headline(Str::plural($model))) @@ -101,11 +101,11 @@ class RoleResource extends Resource ->icon($icon) ->headerActions([ Action::make('count') - ->label(fn (Get $get) => count($get(strtolower($model).'_list'))) + ->label(fn (Get $get) => count($get(strtolower($model) . '_list'))) ->badge(), ]) ->schema([ - CheckboxList::make(strtolower($model).'_list') + CheckboxList::make(strtolower($model) . '_list') ->label('') ->options($options) ->columns() diff --git a/app/Filament/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Resources/ServerResource/Pages/CreateServer.php index 61696804f..b8ac8a520 100644 --- a/app/Filament/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Resources/ServerResource/Pages/CreateServer.php @@ -70,14 +70,14 @@ class CreateServer extends CreateRecord ->prefixIcon('tabler-server') ->label('Name') ->suffixAction(Forms\Components\Actions\Action::make('random') - ->icon('tabler-dice-'.random_int(1, 6)) + ->icon('tabler-dice-' . random_int(1, 6)) ->action(function (Set $set, Get $get) { $egg = Egg::find($get('egg_id')); - $prefix = $egg ? str($egg->name)->lower()->kebab().'-' : ''; + $prefix = $egg ? str($egg->name)->lower()->kebab() . '-' : ''; $word = (new RandomWordService())->word(); - $set('name', $prefix.$word); + $set('name', $prefix . $word); })) ->columnSpan([ 'default' => 2, @@ -101,7 +101,7 @@ class CreateServer extends CreateRecord ]) ->relationship('user', 'username') ->searchable(['username', 'email']) - ->getOptionLabelFromRecordUsing(fn (User $user) => "$user->email | $user->username ".($user->isRootAdmin() ? '(admin)' : '')) + ->getOptionLabelFromRecordUsing(fn (User $user) => "$user->email | $user->username " . ($user->isRootAdmin() ? '(admin)' : '')) ->createOptionForm([ TextInput::make('username') ->alphaNum() @@ -163,7 +163,7 @@ class CreateServer extends CreateRecord $set('allocation_additional.needstobeastringhere.extra_allocations', null); }) ->getOptionLabelFromRecordUsing( - fn (Allocation $allocation) => "$allocation->ip:$allocation->port". + fn (Allocation $allocation) => "$allocation->ip:$allocation->port" . ($allocation->ip_alias ? " ($allocation->ip_alias)" : '') ) ->placeholder(function (Get $get) { @@ -293,7 +293,7 @@ class CreateServer extends CreateRecord ->disabled(fn (Get $get) => $get('../../node_id') === null) ->searchable(['ip', 'port', 'ip_alias']) ->getOptionLabelFromRecordUsing( - fn (Allocation $allocation) => "$allocation->ip:$allocation->port". + fn (Allocation $allocation) => "$allocation->ip:$allocation->port" . ($allocation->ip_alias ? " ($allocation->ip_alias)" : '') ) ->placeholder('Select additional Allocations') @@ -498,7 +498,7 @@ class CreateServer extends CreateRecord ->hintIcon('tabler-code') ->label(fn (Get $get) => $get('name')) ->hintIconTooltip(fn (Get $get) => implode('|', $get('rules'))) - ->prefix(fn (Get $get) => '{{'.$get('env_variable').'}}') + ->prefix(fn (Get $get) => '{{' . $get('env_variable') . '}}') ->helperText(fn (Get $get) => empty($get('description')) ? '—' : $get('description')) ->afterStateUpdated(function (Set $set, Get $get, $state) { $environment = $get($envPath = '../../environment'); @@ -846,7 +846,7 @@ class CreateServer extends CreateRecord return !$containsRuleIn; } - throw new Exception('Component type not supported: '.$component::class); + throw new Exception('Component type not supported: ' . $component::class); } private function getSelectOptionsFromRules(Get $get): array diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index 33a90ace0..267fd998f 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -66,14 +66,14 @@ class EditServer extends EditRecord ->prefixIcon('tabler-server') ->label('Display Name') ->suffixAction(Action::make('random') - ->icon('tabler-dice-'.random_int(1, 6)) + ->icon('tabler-dice-' . random_int(1, 6)) ->action(function (Set $set, Get $get) { $egg = Egg::find($get('egg_id')); - $prefix = $egg ? str($egg->name)->lower()->kebab().'-' : ''; + $prefix = $egg ? str($egg->name)->lower()->kebab() . '-' : ''; $word = (new RandomWordService())->word(); - $set('name', $prefix.$word); + $set('name', $prefix . $word); })) ->columnSpan([ 'default' => 2, @@ -541,7 +541,7 @@ class EditServer extends EditRecord ->hintIcon('tabler-code') ->label(fn (ServerVariable $serverVariable) => $serverVariable->variable->name) ->hintIconTooltip(fn (ServerVariable $serverVariable) => implode('|', $serverVariable->variable->rules)) - ->prefix(fn (ServerVariable $serverVariable) => '{{'.$serverVariable->variable->env_variable.'}}') + ->prefix(fn (ServerVariable $serverVariable) => '{{' . $serverVariable->variable->env_variable . '}}') ->helperText(fn (ServerVariable $serverVariable) => empty($serverVariable->variable->description) ? '—' : $serverVariable->variable->description); } @@ -606,7 +606,7 @@ class EditServer extends EditRecord ->disabled() ->label('JDBC Connection String') ->columnSpan(2) - ->formatStateUsing(fn (Get $get, $record) => 'jdbc:mysql://'.$get('username').':'.urlencode($record->password).'@'.$record->host->host.':'.$record->host->port.'/'.$get('database')), + ->formatStateUsing(fn (Get $get, $record) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($record->password) . '@' . $record->host->host . ':' . $record->host->port . '/' . $get('database')), ]) ->relationship('databases') ->deletable(false) @@ -800,7 +800,7 @@ class EditServer extends EditRecord return $containsRuleIn; } - throw new Exception('Component type not supported: '.$component::class); + throw new Exception('Component type not supported: ' . $component::class); } private function getSelectOptionsFromRules(ServerVariable $serverVariable): array @@ -818,7 +818,7 @@ class EditServer extends EditRecord protected function rotatePassword(DatabasePasswordService $service, $record, $set, $get): void { $newPassword = $service->handle($record); - $jdbcString = 'jdbc:mysql://'.$get('username').':'.urlencode($newPassword).'@'.$record->host->host.':'.$record->host->port.'/'.$get('database'); + $jdbcString = 'jdbc:mysql://' . $get('username') . ':' . urlencode($newPassword) . '@' . $record->host->host . ':' . $record->host->port . '/' . $get('database'); $set('password', $newPassword); $set('JDBC', $jdbcString); diff --git a/app/Filament/Resources/UserResource/Pages/EditProfile.php b/app/Filament/Resources/UserResource/Pages/EditProfile.php index 20bd0f61f..f5c5f5828 100644 --- a/app/Filament/Resources/UserResource/Pages/EditProfile.php +++ b/app/Filament/Resources/UserResource/Pages/EditProfile.php @@ -178,7 +178,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile ->content(fn () => new HtmlString("
$image
")) - ->helperText('Setup Key: '.$secret), + ->helperText('Setup Key: '. $secret), TextInput::make('2facode') ->label('Code') ->requiredWith('2fapassword') diff --git a/app/Filament/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Resources/UserResource/Pages/ListUsers.php index 03df51554..c386d4ce6 100644 --- a/app/Filament/Resources/UserResource/Pages/ListUsers.php +++ b/app/Filament/Resources/UserResource/Pages/ListUsers.php @@ -33,7 +33,7 @@ class ListUsers extends ListRecords ->visibleFrom('lg') ->label('') ->extraImgAttributes(['class' => 'rounded-full']) - ->defaultImageUrl(fn (User $user) => 'https://gravatar.com/avatar/'.md5(strtolower($user->email))), + ->defaultImageUrl(fn (User $user) => 'https://gravatar.com/avatar/' . md5(strtolower($user->email))), TextColumn::make('external_id') ->searchable() ->hidden(), @@ -55,7 +55,7 @@ class ListUsers extends ListRecords ->counts('roles') ->icon('tabler-users-group') ->label('Roles') - ->formatStateUsing(fn (User $user, $state) => $state.($user->isRootAdmin() ? ' (Root Admin)' : '')), + ->formatStateUsing(fn (User $user, $state) => $state . ($user->isRootAdmin() ? ' (Root Admin)' : '')), TextColumn::make('servers_count') ->counts('servers') ->icon('tabler-server') diff --git a/app/Http/Controllers/Admin/Eggs/EggShareController.php b/app/Http/Controllers/Admin/Eggs/EggShareController.php index 56f38f4f7..993064b65 100644 --- a/app/Http/Controllers/Admin/Eggs/EggShareController.php +++ b/app/Http/Controllers/Admin/Eggs/EggShareController.php @@ -30,7 +30,7 @@ class EggShareController extends Controller return response($this->exporterService->handle($egg->id), 200, [ 'Content-Transfer-Encoding' => 'binary', 'Content-Description' => 'File Transfer', - 'Content-Disposition' => 'attachment; filename=egg-'.$filename.'.json', + 'Content-Disposition' => 'attachment; filename=egg-' . $filename . '.json', 'Content-Type' => 'application/json', ]); } diff --git a/app/Http/Controllers/Admin/NodeAutoDeployController.php b/app/Http/Controllers/Admin/NodeAutoDeployController.php index b61e41acb..1029706c3 100644 --- a/app/Http/Controllers/Admin/NodeAutoDeployController.php +++ b/app/Http/Controllers/Admin/NodeAutoDeployController.php @@ -56,7 +56,7 @@ class NodeAutoDeployController extends Controller return new JsonResponse([ 'node' => $node->id, - 'token' => $key->identifier.$key->token, + 'token' => $key->identifier . $key->token, ]); } } diff --git a/app/Http/Controllers/Admin/Servers/CreateServerController.php b/app/Http/Controllers/Admin/Servers/CreateServerController.php index 7e7c19175..c59e22fbe 100644 --- a/app/Http/Controllers/Admin/Servers/CreateServerController.php +++ b/app/Http/Controllers/Admin/Servers/CreateServerController.php @@ -67,6 +67,6 @@ class CreateServerController extends Controller $this->alert->success(trans('admin/server.alerts.server_created'))->flash(); - return new RedirectResponse('/admin/servers/view/'.$server->id); + return new RedirectResponse('/admin/servers/view/' . $server->id); } } diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 4cb398bbe..9ddd9c7e6 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -115,7 +115,7 @@ class ServersController extends Controller { $this->suspensionService->toggle($server, $request->input('action')); $this->alert->success(trans('admin/server.alerts.suspension_toggled', [ - 'status' => $request->input('action').'ed', + 'status' => $request->input('action') . 'ed', ]))->flash(); return redirect()->route('admin.servers.view.manage', $server->id); diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index bd175aef5..09d354a36 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -83,7 +83,7 @@ class FileController extends ClientApiController 'file_path' => rawurldecode($request->get('file')), 'server_uuid' => $server->uuid, ]) - ->handle($server->node, $request->user()->id.$server->uuid); + ->handle($server->node, $request->user()->id . $server->uuid); Activity::event('server:file.download')->property('file', $request->get('file'))->log(); diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index 9ee74fb44..e48dd75bd 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -43,7 +43,7 @@ class FileUploadController extends ClientApiController ->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) ->setUser($user) ->setClaims(['server_uuid' => $server->uuid]) - ->handle($server->node, $user->id.$server->uuid); + ->handle($server->node, $user->id . $server->uuid); return sprintf( '%s/upload/file?token=%s', diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 8d636872d..0fb062e96 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -59,14 +59,14 @@ class WebsocketController extends ClientApiController 'server_uuid' => $server->uuid, 'permissions' => $permissions, ]) - ->handle($node, $user->id.$server->uuid); + ->handle($node, $user->id . $server->uuid); $socket = str_replace(['https://', 'http://'], ['wss://', 'ws://'], $node->getConnectionAddress()); return new JsonResponse([ 'data' => [ 'token' => $token->toString(), - 'socket' => $socket.sprintf('/api/servers/%s/ws', $server->uuid), + 'socket' => $socket . sprintf('/api/servers/%s/ws', $server->uuid), ], ]); } diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php index 47350c69d..4f32689ec 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupStatusController.php @@ -64,7 +64,7 @@ class BackupStatusController extends Controller // deleted easily. Also does not make sense to have a locked backup on the system // that is failed. 'is_locked' => $successful ? $model->is_locked : false, - 'checksum' => $successful ? ($request->input('checksum_type').':'.$request->input('checksum')) : null, + 'checksum' => $successful ? ($request->input('checksum_type') . ':' . $request->input('checksum')) : null, 'bytes' => $successful ? $request->input('size') : 0, 'completed_at' => CarbonImmutable::now(), ])->save(); diff --git a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php index f9e63dfb5..9b59704f1 100644 --- a/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php +++ b/app/Http/Controllers/Api/Remote/SftpAuthenticationController.php @@ -160,6 +160,6 @@ class SftpAuthenticationController extends Controller { $username = explode('.', strrev($request->input('username', ''))); - return strtolower(strrev($username[0] ?? '').'|'.$request->ip()); + return strtolower(strrev($username[0] ?? '') . '|' . $request->ip()); } } diff --git a/app/Http/Controllers/Auth/OAuthController.php b/app/Http/Controllers/Auth/OAuthController.php index 34f0b3bbc..2989761ef 100644 --- a/app/Http/Controllers/Auth/OAuthController.php +++ b/app/Http/Controllers/Auth/OAuthController.php @@ -48,7 +48,7 @@ class OAuthController extends Controller } try { - $user = User::query()->whereJsonContains('oauth->'.$driver, $oauthUser->getId())->firstOrFail(); + $user = User::query()->whereJsonContains('oauth->'. $driver, $oauthUser->getId())->firstOrFail(); $this->auth->guard()->login($user, true); } catch (Exception $e) { diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index a1c6d4710..c9f3bf7dc 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -43,6 +43,6 @@ class AuthenticateIPAccess ->property('identifier', $token->identifier) ->log(); - throw new AccessDeniedHttpException('This IP address ('.$request->ip().') does not have permission to access the API using these credentials.'); + throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.'); } } diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index d7754d36e..0ead01f1d 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -80,7 +80,7 @@ class ResourceBelongsToServer default: // Don't return a 404 here since we want to make sure no one relies // on this middleware in a context in which it will not work. Fail safe. - throw new \InvalidArgumentException('There is no handler configured for a resource of this type: '.get_class($model)); + throw new \InvalidArgumentException('There is no handler configured for a resource of this type: ' . get_class($model)); } } diff --git a/app/Http/Middleware/Api/IsValidJson.php b/app/Http/Middleware/Api/IsValidJson.php index 77bd25fe8..86bb34ff2 100644 --- a/app/Http/Middleware/Api/IsValidJson.php +++ b/app/Http/Middleware/Api/IsValidJson.php @@ -18,7 +18,7 @@ class IsValidJson try { json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { - throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: '.$exception->getMessage()); + throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: ' . $exception->getMessage()); } } diff --git a/app/Http/Middleware/RequireTwoFactorAuthentication.php b/app/Http/Middleware/RequireTwoFactorAuthentication.php index bfbab4438..58ff1564d 100644 --- a/app/Http/Middleware/RequireTwoFactorAuthentication.php +++ b/app/Http/Middleware/RequireTwoFactorAuthentication.php @@ -38,7 +38,7 @@ class RequireTwoFactorAuthentication public function handle(Request $request, \Closure $next): mixed { $user = $request->user(); - $uri = rtrim($request->getRequestUri(), '/').'/'; + $uri = rtrim($request->getRequestUri(), '/') . '/'; $current = $request->route()->getName(); if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { diff --git a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php index b092ead91..83f80f267 100644 --- a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php +++ b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php @@ -17,7 +17,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest $modelRules = ApiKey::getRules(); return collect(AdminAcl::getResourceList())->mapWithKeys(function ($resource) use ($modelRules) { - return [AdminAcl::COLUMN_IDENTIFIER.$resource => $modelRules['r_'.$resource]]; + return [AdminAcl::COLUMN_IDENTIFIER . $resource => $modelRules['r_' . $resource]]; })->merge(['memo' => $modelRules['memo']])->toArray(); } diff --git a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php index b7e64daaa..c6720aa2c 100644 --- a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php @@ -15,7 +15,7 @@ class EggVariableFormRequest extends AdminFormRequest return [ 'name' => 'required|string|min:1|max:255', 'description' => 'sometimes|nullable|string', - 'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:'.EggVariable::RESERVED_ENV_NAMES, + 'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES, 'options' => 'sometimes|required|array', 'rules' => 'bail|required|string', 'default_value' => 'present', diff --git a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php index 866832214..e0034fcfe 100644 --- a/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php +++ b/app/Http/Requests/Api/Client/Account/StoreApiKeyRequest.php @@ -39,7 +39,7 @@ class StoreApiKeyRequest extends ClientApiRequest throw $exception; } } finally { - $validator->errors()->addIf(!$valid, "allowed_ips.{$index}", '"'.$ip.'" is not a valid IP address or CIDR range.'); + $validator->errors()->addIf(!$valid, "allowed_ips.{$index}", '"' . $ip . '" is not a valid IP address or CIDR range.'); } } }); diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index d4b0cabce..e4a47ada7 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -73,7 +73,7 @@ class RunTaskJob extends Job implements ShouldQueue $deleteFilesService->handle($server, explode(PHP_EOL, $this->task->payload)); break; default: - throw new \InvalidArgumentException('Invalid task action provided: '.$this->task->action); + throw new \InvalidArgumentException('Invalid task action provided: ' . $this->task->action); } } catch (\Exception $exception) { // If this isn't a DaemonConnectionException on a task that allows for failures diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index 6593803e2..96c714f24 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -110,14 +110,14 @@ class ApiKey extends Model 'memo', 'last_used_at', 'expires_at', - 'r_'.AdminAcl::RESOURCE_USERS, - 'r_'.AdminAcl::RESOURCE_ALLOCATIONS, - 'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS, - 'r_'.AdminAcl::RESOURCE_SERVER_DATABASES, - 'r_'.AdminAcl::RESOURCE_EGGS, - 'r_'.AdminAcl::RESOURCE_NODES, - 'r_'.AdminAcl::RESOURCE_SERVERS, - 'r_'.AdminAcl::RESOURCE_MOUNTS, + 'r_' . AdminAcl::RESOURCE_USERS, + 'r_' . AdminAcl::RESOURCE_ALLOCATIONS, + 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS, + 'r_' . AdminAcl::RESOURCE_SERVER_DATABASES, + 'r_' . AdminAcl::RESOURCE_EGGS, + 'r_' . AdminAcl::RESOURCE_NODES, + 'r_' . AdminAcl::RESOURCE_SERVERS, + 'r_' . AdminAcl::RESOURCE_MOUNTS, ]; /** @@ -146,14 +146,14 @@ class ApiKey extends Model 'allowed_ips.*' => 'string', 'last_used_at' => 'nullable|date', 'expires_at' => 'nullable|date', - 'r_'.AdminAcl::RESOURCE_USERS => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_ALLOCATIONS => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_SERVER_DATABASES => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_EGGS => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_NODES => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3', - 'r_'.AdminAcl::RESOURCE_MOUNTS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_USERS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_EGGS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_NODES => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3', + 'r_' . AdminAcl::RESOURCE_MOUNTS => 'integer|min:0|max:3', ]; protected function casts(): array @@ -166,14 +166,14 @@ class ApiKey extends Model 'token' => 'encrypted', self::CREATED_AT => 'datetime', self::UPDATED_AT => 'datetime', - 'r_'.AdminAcl::RESOURCE_USERS => 'int', - 'r_'.AdminAcl::RESOURCE_ALLOCATIONS => 'int', - 'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS => 'int', - 'r_'.AdminAcl::RESOURCE_SERVER_DATABASES => 'int', - 'r_'.AdminAcl::RESOURCE_EGGS => 'int', - 'r_'.AdminAcl::RESOURCE_NODES => 'int', - 'r_'.AdminAcl::RESOURCE_SERVERS => 'int', - 'r_'.AdminAcl::RESOURCE_MOUNTS => 'int', + 'r_' . AdminAcl::RESOURCE_USERS => 'int', + 'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int', + 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int', + 'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'int', + 'r_' . AdminAcl::RESOURCE_EGGS => 'int', + 'r_' . AdminAcl::RESOURCE_NODES => 'int', + 'r_' . AdminAcl::RESOURCE_SERVERS => 'int', + 'r_' . AdminAcl::RESOURCE_MOUNTS => 'int', ]; } @@ -227,6 +227,6 @@ class ApiKey extends Model { $prefix = self::getPrefixForType($type); - return $prefix.Str::random(self::IDENTIFIER_LENGTH - strlen($prefix)); + return $prefix . Str::random(self::IDENTIFIER_LENGTH - strlen($prefix)); } } diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index b56213c1a..2d3a4fb2c 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -54,7 +54,7 @@ class EggVariable extends Model 'sort' => 'nullable', 'name' => 'required|string|between:1,255', 'description' => 'string', - 'env_variable' => 'required|alphaDash|between:1,255|notIn:'.self::RESERVED_ENV_NAMES, + 'env_variable' => 'required|alphaDash|between:1,255|notIn:' . self::RESERVED_ENV_NAMES, 'default_value' => 'string', 'user_viewable' => 'boolean', 'user_editable' => 'boolean', diff --git a/app/Models/Filters/MultiFieldServerFilter.php b/app/Models/Filters/MultiFieldServerFilter.php index 6039c450b..d2c552321 100644 --- a/app/Models/Filters/MultiFieldServerFilter.php +++ b/app/Models/Filters/MultiFieldServerFilter.php @@ -48,7 +48,7 @@ class MultiFieldServerFilter implements Filter }, // Otherwise, just try to search for that specific port in the allocations. function (Builder $builder) use ($value) { - $builder->orWhere('allocations.port', 'LIKE', substr($value, 1).'%'); + $builder->orWhere('allocations.port', 'LIKE', substr($value, 1) . '%'); } ); }) diff --git a/app/Models/Node.php b/app/Models/Node.php index 59a337f2b..da5416091 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -184,8 +184,8 @@ class Node extends Model 'port' => $this->daemon_listen, 'ssl' => [ 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), - 'cert' => '/etc/letsencrypt/live/'.Str::lower($this->fqdn).'/fullchain.pem', - 'key' => '/etc/letsencrypt/live/'.Str::lower($this->fqdn).'/privkey.pem', + 'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem', + 'key' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/privkey.pem', ], 'upload_limit' => $this->upload_size, ], diff --git a/app/Models/User.php b/app/Models/User.php index 04ecbb0c4..3ccafe404 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -259,7 +259,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac */ public function getNameAttribute(): string { - return trim($this->name_first.' '.$this->name_last); + return trim($this->name_first . ' ' . $this->name_last); } /** @@ -379,7 +379,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac public function getFilamentAvatarUrl(): ?string { - return 'https://gravatar.com/avatar/'.md5(strtolower($this->email)); + return 'https://gravatar.com/avatar/' . md5(strtolower($this->email)); } public function canTarget(IlluminateModel $user): bool diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 0f7cb77a7..0123435f7 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -33,13 +33,13 @@ class AccountCreated extends Notification implements ShouldQueue public function toMail(): MailMessage { $message = (new MailMessage()) - ->greeting('Hello '.$this->user->name.'!') - ->line('You are receiving this email because an account has been created for you on '.config('app.name').'.') - ->line('Username: '.$this->user->username) - ->line('Email: '.$this->user->email); + ->greeting('Hello ' . $this->user->name . '!') + ->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.') + ->line('Username: ' . $this->user->username) + ->line('Email: ' . $this->user->email); if (!is_null($this->token)) { - return $message->action('Setup Your Account', url('/auth/password/reset/'.$this->token.'?email='.urlencode($this->user->email))); + return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($this->user->email))); } return $message; diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 56ddd4a40..647c33822 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -35,9 +35,9 @@ class AddedToServer extends Notification implements ShouldQueue public function toMail(): MailMessage { return (new MailMessage()) - ->greeting('Hello '.$this->server->user.'!') + ->greeting('Hello ' . $this->server->user . '!') ->line('You have been added as a subuser for the following server, allowing you certain control over the server.') - ->line('Server Name: '.$this->server->name) - ->action('Visit Server', url('/server/'.$this->server->uuid_short)); + ->line('Server Name: ' . $this->server->name) + ->action('Visit Server', url('/server/' . $this->server->uuid_short)); } } diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index 0dcbb4e9c..3bb816bf7 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -21,7 +21,7 @@ class MailTested extends Notification { return (new MailMessage()) ->subject('Panel Test Message') - ->greeting('Hello '.$this->user->name.'!') + ->greeting('Hello ' . $this->user->name . '!') ->line('This is a test of the Panel mail system. You\'re good to go!'); } } diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index 6c7899d6a..668d8f28a 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -36,9 +36,9 @@ class RemovedFromServer extends Notification implements ShouldQueue { return (new MailMessage()) ->error() - ->greeting('Hello '.$this->server->user.'.') + ->greeting('Hello ' . $this->server->user . '.') ->line('You have been removed as a subuser for the following server.') - ->line('Server Name: '.$this->server->name) + ->line('Server Name: ' . $this->server->name) ->action('Visit Panel', route('index')); } } diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index 381b731a7..434d1dd48 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -34,7 +34,7 @@ class SendPasswordReset extends Notification implements ShouldQueue return (new MailMessage()) ->subject('Reset Password') ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', url('/auth/password/reset/'.$this->token.'?email='.urlencode($notifiable->email))) + ->action('Reset Password', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($notifiable->email))) ->line('If you did not request a password reset, no further action is required.'); } } diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index f23371bc3..fa6500afa 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -51,9 +51,9 @@ class ServerInstalled extends Notification implements ShouldQueue public function toMail(): MailMessage { return (new MailMessage()) - ->greeting('Hello '.$this->user->username.'.') + ->greeting('Hello ' . $this->user->username . '.') ->line('Your server has finished installing and is now ready for you to use.') - ->line('Server Name: '.$this->server->name) + ->line('Server Name: ' . $this->server->name) ->action('Login and Begin Using', route('index')); } } diff --git a/app/Policies/DefaultPolicies.php b/app/Policies/DefaultPolicies.php index e1d2890ab..3035cae19 100644 --- a/app/Policies/DefaultPolicies.php +++ b/app/Policies/DefaultPolicies.php @@ -12,7 +12,7 @@ trait DefaultPolicies */ public function viewAny(User $user): bool { - return $user->can('viewList '.$this->modelName); + return $user->can('viewList ' . $this->modelName); } /** @@ -20,7 +20,7 @@ trait DefaultPolicies */ public function view(User $user, Model $model): bool { - return $user->can('view '.$this->modelName, $model); + return $user->can('view ' . $this->modelName, $model); } /** @@ -28,7 +28,7 @@ trait DefaultPolicies */ public function create(User $user): bool { - return $user->can('create '.$this->modelName); + return $user->can('create ' . $this->modelName); } /** @@ -36,7 +36,7 @@ trait DefaultPolicies */ public function update(User $user, Model $model): bool { - return $user->can('update '.$this->modelName, $model); + return $user->can('update ' . $this->modelName, $model); } /** @@ -44,6 +44,6 @@ trait DefaultPolicies */ public function delete(User $user, Model $model): bool { - return $user->can('delete '.$this->modelName, $model); + return $user->can('delete ' . $this->modelName, $model); } } diff --git a/app/Repositories/Daemon/DaemonConfigurationRepository.php b/app/Repositories/Daemon/DaemonConfigurationRepository.php index 86b8418ea..52cda56dd 100644 --- a/app/Repositories/Daemon/DaemonConfigurationRepository.php +++ b/app/Repositories/Daemon/DaemonConfigurationRepository.php @@ -19,7 +19,7 @@ class DaemonConfigurationRepository extends DaemonRepository $response = $this ->getHttpClient() ->connectTimeout($connectTimeout) - ->get('/api/system'.(!is_null($version) ? '?v='.$version : '')); + ->get('/api/system' . (!is_null($version) ? '?v=' . $version : '')); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); } diff --git a/app/Repositories/Daemon/DaemonServerRepository.php b/app/Repositories/Daemon/DaemonServerRepository.php index 8656adc74..ce91ece2b 100644 --- a/app/Repositories/Daemon/DaemonServerRepository.php +++ b/app/Repositories/Daemon/DaemonServerRepository.php @@ -96,7 +96,7 @@ class DaemonServerRepository extends DaemonRepository Assert::isInstanceOf($this->server, Server::class); try { - $this->getHttpClient()->delete('/api/servers/'.$this->server->uuid); + $this->getHttpClient()->delete('/api/servers/' . $this->server->uuid); } catch (TransferException $exception) { throw new DaemonConnectionException($exception); } @@ -192,7 +192,7 @@ class DaemonServerRepository extends DaemonRepository { Assert::isInstanceOf($this->server, Server::class); - $this->revokeJTIs([md5($id.$this->server->uuid)]); + $this->revokeJTIs([md5($id . $this->server->uuid)]); } /** diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index fc7b176ca..90ec6480a 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -62,7 +62,7 @@ class AdminAcl */ public static function check(ApiKey $key, string $resource, int $action = self::READ): bool { - return self::can(data_get($key, self::COLUMN_IDENTIFIER.$resource, self::NONE), $action); + return self::can(data_get($key, self::COLUMN_IDENTIFIER . $resource, self::NONE), $action); } /** diff --git a/app/Services/Backups/DownloadLinkService.php b/app/Services/Backups/DownloadLinkService.php index ed3867266..a167a1bb2 100644 --- a/app/Services/Backups/DownloadLinkService.php +++ b/app/Services/Backups/DownloadLinkService.php @@ -34,7 +34,7 @@ class DownloadLinkService 'backup_uuid' => $backup->uuid, 'server_uuid' => $backup->server->uuid, ]) - ->handle($backup->server->node, $user->id.$backup->server->uuid); + ->handle($backup->server->node, $user->id . $backup->server->uuid); return sprintf('%s/download/backup?token=%s', $backup->server->node->getConnectionAddress(), $token->toString()); } diff --git a/app/Services/Files/DeleteFilesService.php b/app/Services/Files/DeleteFilesService.php index f0a4f202c..1692923ed 100644 --- a/app/Services/Files/DeleteFilesService.php +++ b/app/Services/Files/DeleteFilesService.php @@ -30,7 +30,7 @@ class DeleteFilesService $pattern = basename($line); collect($this->daemonFileRepository->setServer($server)->getDirectory($path))->each(function ($item) use ($path, $pattern, $filesToDelete) { if (Str::is($pattern, $item['name'])) { - $filesToDelete->push($path.'/'.$item['name']); + $filesToDelete->push($path . '/' . $item['name']); } }); } diff --git a/app/Services/Helpers/AssetHashService.php b/app/Services/Helpers/AssetHashService.php index 304dabdfc..f94c32f3b 100644 --- a/app/Services/Helpers/AssetHashService.php +++ b/app/Services/Helpers/AssetHashService.php @@ -70,7 +70,7 @@ class AssetHashService $output .= " $key=\"$value\""; } - return $output.'>'; + return $output . '>'; } /** @@ -92,7 +92,7 @@ class AssetHashService $output .= " $key=\"$value\""; } - return $output.'>'; + return $output . '>'; } /** diff --git a/app/Services/Helpers/SoftwareVersionService.php b/app/Services/Helpers/SoftwareVersionService.php index 18c212d99..7d50203bf 100644 --- a/app/Services/Helpers/SoftwareVersionService.php +++ b/app/Services/Helpers/SoftwareVersionService.php @@ -127,13 +127,13 @@ class SoftwareVersionService $head = explode(' ', file_get_contents(base_path('.git/HEAD'))); if (array_key_exists(1, $head)) { - $path = base_path('.git/'.trim($head[1])); + $path = base_path('.git/' . trim($head[1])); } } if (isset($path) && file_exists($path)) { return [ - 'version' => 'canary ('.substr(file_get_contents($path), 0, 8).')', + 'version' => 'canary (' . substr(file_get_contents($path), 0, 8) . ')', 'is_git' => true, ]; } diff --git a/app/Services/Servers/StartupCommandService.php b/app/Services/Servers/StartupCommandService.php index 1c6ff1be2..4703eb075 100644 --- a/app/Services/Servers/StartupCommandService.php +++ b/app/Services/Servers/StartupCommandService.php @@ -15,7 +15,7 @@ class StartupCommandService $replace = [$server->memory, $server->allocation->ip, $server->allocation->port]; foreach ($server->variables as $variable) { - $find[] = '{{'.$variable->env_variable.'}}'; + $find[] = '{{' . $variable->env_variable . '}}'; $replace[] = ($variable->user_viewable && !$hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]'; } diff --git a/app/Services/Servers/TransferServerService.php b/app/Services/Servers/TransferServerService.php index 070f84f32..4312369dd 100644 --- a/app/Services/Servers/TransferServerService.php +++ b/app/Services/Servers/TransferServerService.php @@ -31,8 +31,8 @@ class TransferServerService Http::daemon($server->node)->post('/api/transfer', [ 'json' => [ 'server_id' => $server->uuid, - 'url' => $server->node->getConnectionAddress()."/api/servers/$server->uuid/archive", - 'token' => 'Bearer '.$token->toString(), + 'url' => $server->node->getConnectionAddress() . "/api/servers/$server->uuid/archive", + 'token' => 'Bearer ' . $token->toString(), 'server' => [ 'uuid' => $server->uuid, 'start_on_completion' => false, diff --git a/app/Services/Servers/VariableValidatorService.php b/app/Services/Servers/VariableValidatorService.php index 904e494d9..75f4a59b1 100644 --- a/app/Services/Servers/VariableValidatorService.php +++ b/app/Services/Servers/VariableValidatorService.php @@ -40,8 +40,8 @@ class VariableValidatorService $data = $rules = $customAttributes = []; foreach ($variables as $variable) { $data['environment'][$variable->env_variable] = array_get($fields, $variable->env_variable); - $rules['environment.'.$variable->env_variable] = $variable->rules; - $customAttributes['environment.'.$variable->env_variable] = trans('validation.internal.variable_value', ['env' => $variable->name]); + $rules['environment.' . $variable->env_variable] = $variable->rules; + $customAttributes['environment.' . $variable->env_variable] = trans('validation.internal.variable_value', ['env' => $variable->name]); } $validator = $this->validator->make($data, $rules, [], $customAttributes); diff --git a/app/Services/Subusers/SubuserCreationService.php b/app/Services/Subusers/SubuserCreationService.php index 0439afd52..0f9508ba7 100644 --- a/app/Services/Subusers/SubuserCreationService.php +++ b/app/Services/Subusers/SubuserCreationService.php @@ -39,7 +39,7 @@ class SubuserCreationService if (!$user) { // Just cap the username generated at 64 characters at most and then append a random string // to the end to make it "unique"... - $username = substr(preg_replace('/([^\w\.-]+)/', '', strtok($email, '@')), 0, 64).Str::random(3); + $username = substr(preg_replace('/([^\w\.-]+)/', '', strtok($email, '@')), 0, 64) . Str::random(3); $user = $this->userCreationService->handle([ 'email' => $email, diff --git a/app/Traits/EnvironmentWriterTrait.php b/app/Traits/EnvironmentWriterTrait.php index 201116571..cb5bef047 100644 --- a/app/Traits/EnvironmentWriterTrait.php +++ b/app/Traits/EnvironmentWriterTrait.php @@ -37,10 +37,10 @@ trait EnvironmentWriterTrait $key = strtoupper($key); $saveValue = sprintf('%s=%s', $key, $this->escapeEnvironmentValue($value ?? '')); - if (preg_match_all('/^'.$key.'=(.*)$/m', $saveContents) < 1) { - $saveContents = $saveContents.PHP_EOL.$saveValue; + if (preg_match_all('/^' . $key . '=(.*)$/m', $saveContents) < 1) { + $saveContents = $saveContents . PHP_EOL . $saveValue; } else { - $saveContents = preg_replace('/^'.$key.'=(.*)$/m', $saveValue, $saveContents); + $saveContents = preg_replace('/^' . $key . '=(.*)$/m', $saveValue, $saveContents); } }); diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 8ae888142..e2f3650f4 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -62,7 +62,7 @@ class ActivityLogTransformer extends BaseClientTransformer if (!is_array($value)) { // Perform some directory normalization at this point. if ($key === 'directory') { - $value = str_replace('//', '/', '/'.trim($value, '/').'/'); + $value = str_replace('//', '/', '/' . trim($value, '/') . '/'); } return [$key => $value]; @@ -94,7 +94,7 @@ class ActivityLogTransformer extends BaseClientTransformer return false; } - $str = trans('activity.'.str_replace(':', '.', $model->event)); + $str = trans('activity.' . str_replace(':', '.', $model->event)); preg_match_all('/:(?[\w.-]+\w)(?:[^\w:]?|$)/', $str, $matches); $exclude = array_merge($matches['key'], ['ip', 'useragent', 'using_sftp']); diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index 06160a722..f875463e5 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -28,7 +28,7 @@ class UserTransformer extends BaseClientTransformer 'first_name' => $user->name_first, 'last_name' => $user->name_last, 'language' => $user->language, - 'image' => 'https://gravatar.com/avatar/'.md5(Str::lower($user->email)), // deprecated + 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)), // deprecated 'admin' => $user->isRootAdmin(), // deprecated, use "root_admin" 'root_admin' => $user->isRootAdmin(), '2fa_enabled' => (bool) $user->use_totp, diff --git a/bootstrap/tests.php b/bootstrap/tests.php index 148613856..a80e0b27f 100644 --- a/bootstrap/tests.php +++ b/bootstrap/tests.php @@ -5,9 +5,9 @@ use NunoMaduro\Collision\Provider; use Illuminate\Contracts\Console\Kernel; use Symfony\Component\Console\Output\ConsoleOutput; -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; -$app = require __DIR__.'/app.php'; +$app = require __DIR__ . '/app.php'; /** @var \App\Console\Kernel $kernel */ $kernel = $app->make(Kernel::class); @@ -23,10 +23,10 @@ $kernel->bootstrap(); $output = new ConsoleOutput(); -$prefix = 'database.connections.'.config('database.default'); +$prefix = 'database.connections.' . config('database.default'); if (!Str::contains(config("$prefix.database"), 'test')) { - $output->writeln(PHP_EOL.'Cannot run test process against non-testing database.'); - $output->writeln(PHP_EOL.'Environment is currently pointed at: "'.config("$prefix.database").'".'); + $output->writeln(PHP_EOL . 'Cannot run test process against non-testing database.'); + $output->writeln(PHP_EOL . 'Environment is currently pointed at: "' . config("$prefix.database") . '".'); exit(1); } @@ -35,11 +35,11 @@ if (!Str::contains(config("$prefix.database"), 'test')) { * running the tests. */ if (!env('SKIP_MIGRATIONS')) { - $output->writeln(PHP_EOL.'Refreshing database for Integration tests...'); + $output->writeln(PHP_EOL . 'Refreshing database for Integration tests...'); $kernel->call('migrate:fresh'); - $output->writeln('Seeding database for Integration tests...'.PHP_EOL); + $output->writeln('Seeding database for Integration tests...' . PHP_EOL); $kernel->call('db:seed'); } else { - $output->writeln(PHP_EOL.'Skipping database migrations...'.PHP_EOL); + $output->writeln(PHP_EOL . 'Skipping database migrations...' . PHP_EOL); } diff --git a/database/Factories/NodeFactory.php b/database/Factories/NodeFactory.php index 7d0ac25a1..19a1fbf7b 100644 --- a/database/Factories/NodeFactory.php +++ b/database/Factories/NodeFactory.php @@ -24,7 +24,7 @@ class NodeFactory extends Factory return [ 'uuid' => Uuid::uuid4()->toString(), 'public' => true, - 'name' => 'FactoryNode_'.Str::random(10), + 'name' => 'FactoryNode_' . Str::random(10), 'fqdn' => $this->faker->unique()->ipv4(), 'scheme' => 'http', 'behind_proxy' => false, diff --git a/database/Factories/UserFactory.php b/database/Factories/UserFactory.php index 6284e7471..3c6003cc2 100644 --- a/database/Factories/UserFactory.php +++ b/database/Factories/UserFactory.php @@ -27,8 +27,8 @@ class UserFactory extends Factory return [ 'external_id' => null, 'uuid' => Uuid::uuid4()->toString(), - 'username' => $this->faker->userName().'_'.Str::random(10), - 'email' => Str::random(32).'@example.com', + 'username' => $this->faker->userName() . '_' . Str::random(10), + 'email' => Str::random(32) . '@example.com', 'name_first' => $this->faker->firstName(), 'name_last' => $this->faker->lastName(), 'password' => $password ?: $password = bcrypt('password'), diff --git a/database/Seeders/EggSeeder.php b/database/Seeders/EggSeeder.php index 3053bfa76..dcbc4f25c 100644 --- a/database/Seeders/EggSeeder.php +++ b/database/Seeders/EggSeeder.php @@ -47,9 +47,9 @@ class EggSeeder extends Seeder */ protected function parseEggFiles($name) { - $files = new \DirectoryIterator(database_path('Seeders/eggs/'.kebab_case($name))); + $files = new \DirectoryIterator(database_path('Seeders/eggs/' . kebab_case($name))); - $this->command->alert('Updating Eggs for: '.$name); + $this->command->alert('Updating Eggs for: ' . $name); /** @var \DirectoryIterator $file */ foreach ($files as $file) { if (!$file->isFile() || !$file->isReadable()) { @@ -71,10 +71,10 @@ class EggSeeder extends Seeder if ($egg instanceof Egg) { $this->importerService->fromFile($file, $egg); - $this->command->info('Updated '.$decoded['name']); + $this->command->info('Updated ' . $decoded['name']); } else { $this->importerService->fromFile($file); - $this->command->comment('Created '.$decoded['name']); + $this->command->comment('Created ' . $decoded['name']); } } diff --git a/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php b/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php index 5d8d38e6d..b96b2ba24 100644 --- a/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php +++ b/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php @@ -17,7 +17,7 @@ return new class extends Migration DB::transaction(function () { foreach (DB::table('service_variables')->get() as $variable) { - $variable->rules = ($variable->required) ? 'required|regex:'.$variable->rules : 'regex:'.$variable->rules; + $variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->rules; $variable->save(); } }); diff --git a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php index 4e50c9a84..aca8afb6c 100644 --- a/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php +++ b/database/migrations/2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem.php @@ -17,7 +17,7 @@ return new class extends Migration continue; } - $newPermission = $parts[0].'-'.str_replace('task', 'schedule', $parts[1]); + $newPermission = $parts[0] . '-' . str_replace('task', 'schedule', $parts[1]); DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]); } @@ -35,7 +35,7 @@ return new class extends Migration continue; } - $newPermission = $parts[0].'-'.str_replace('schedule', 'task', $parts[1]); + $newPermission = $parts[0] . '-' . str_replace('schedule', 'task', $parts[1]); DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]); } diff --git a/database/migrations/2017_09_23_173628_RemoveDaemonSecretFromServersTable.php b/database/migrations/2017_09_23_173628_RemoveDaemonSecretFromServersTable.php index e99078b66..ab2e8056e 100644 --- a/database/migrations/2017_09_23_173628_RemoveDaemonSecretFromServersTable.php +++ b/database/migrations/2017_09_23_173628_RemoveDaemonSecretFromServersTable.php @@ -21,7 +21,7 @@ return new class extends Migration $inserts[] = [ 'user_id' => $server->owner_id, 'server_id' => $server->id, - 'secret' => DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER.str_random(40), + 'secret' => DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40), 'expires_at' => Carbon::now()->addMinutes(config('panel.api.key_expire_time', 720))->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), diff --git a/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php b/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php index 60b0d6358..9090be407 100644 --- a/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php +++ b/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php @@ -19,7 +19,7 @@ return new class extends Migration $inserts[] = [ 'user_id' => $subuser->user_id, 'server_id' => $subuser->server_id, - 'secret' => DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER.str_random(40), + 'secret' => DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40), 'expires_at' => Carbon::now()->addMinutes(config('panel.api.key_expire_time', 720))->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(), diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index 2a10ba96c..6a9280b5f 100644 --- a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php +++ b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php @@ -112,9 +112,9 @@ return new class extends Migration } if (!empty($values)) { - $string = 'VALUES '.implode(', ', array_fill(0, count($values) / 2, '(?, ?)')); + $string = 'VALUES ' . implode(', ', array_fill(0, count($values) / 2, '(?, ?)')); - DB::insert('INSERT INTO permissions(`subuser_id`, `permission`) '.$string, $values); + DB::insert('INSERT INTO permissions(`subuser_id`, `permission`) ' . $string, $values); } } diff --git a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php index d98bbc3c8..911461d70 100644 --- a/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php +++ b/database/migrations/2020_04_10_141024_store_node_tokens_as_encrypted_value.php @@ -53,7 +53,7 @@ return new class extends Migration DB::transaction(function () { foreach (DB::select('SELECT id, daemon_token_id, daemon_token FROM nodes') as $datum) { DB::update('UPDATE nodes SET daemon_token = ? WHERE id = ?', [ - $datum->daemon_token_id.decrypt($datum->daemon_token), + $datum->daemon_token_id . decrypt($datum->daemon_token), $datum->id, ]); } diff --git a/pint.json b/pint.json index 9427029f8..99fa80d3a 100644 --- a/pint.json +++ b/pint.json @@ -1,6 +1,7 @@ { "preset": "laravel", "rules": { + "concat_space": false, "not_operator_with_successor_space": false, "ordered_imports": false } diff --git a/tests/Assertions/AssertsActivityLogged.php b/tests/Assertions/AssertsActivityLogged.php index ed33729e4..23a3461b1 100644 --- a/tests/Assertions/AssertsActivityLogged.php +++ b/tests/Assertions/AssertsActivityLogged.php @@ -35,7 +35,7 @@ trait AssertsActivityLogged public function assertActivitySubjects(string $event, Model|array $subjects): void { if (is_array($subjects)) { - \Webmozart\Assert\Assert::lessThanEq(count(func_get_args()), 2, 'Invalid call to '.__METHOD__.': cannot provide additional arguments if providing an array.'); + \Webmozart\Assert\Assert::lessThanEq(count(func_get_args()), 2, 'Invalid call to ' . __METHOD__ . ': cannot provide additional arguments if providing an array.'); } else { $subjects = array_slice(func_get_args(), 1); } diff --git a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php index 4a8441abe..ab24f0311 100644 --- a/tests/Assertions/MiddlewareAttributeAssertionsTrait.php +++ b/tests/Assertions/MiddlewareAttributeAssertionsTrait.php @@ -11,7 +11,7 @@ trait MiddlewareAttributeAssertionsTrait */ public function assertRequestHasAttribute(string $attribute): void { - Assert::assertTrue($this->request->attributes->has($attribute), 'Assert that request mock has '.$attribute.' attribute.'); + Assert::assertTrue($this->request->attributes->has($attribute), 'Assert that request mock has ' . $attribute . ' attribute.'); } /** @@ -19,7 +19,7 @@ trait MiddlewareAttributeAssertionsTrait */ public function assertRequestMissingAttribute(string $attribute): void { - Assert::assertFalse($this->request->attributes->has($attribute), 'Assert that request mock does not have '.$attribute.' attribute.'); + Assert::assertFalse($this->request->attributes->has($attribute), 'Assert that request mock does not have ' . $attribute . ' attribute.'); } /** diff --git a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php index 02b674a9a..c104a3eae 100644 --- a/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php +++ b/tests/Integration/Api/Application/ApplicationApiIntegrationTestCase.php @@ -38,7 +38,7 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase $this ->withHeader('Accept', 'application/vnd.panel.v1+json') - ->withHeader('Authorization', 'Bearer '.$this->key->identifier.$this->key->token); + ->withHeader('Authorization', 'Bearer ' . $this->key->identifier . $this->key->token); } public function getApiUser(): User @@ -58,7 +58,7 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase { $this->key = $this->createApiKey($user, $permissions); - $this->withHeader('Authorization', 'Bearer '.$this->key->identifier.$this->key->token); + $this->withHeader('Authorization', 'Bearer ' . $this->key->identifier . $this->key->token); return $this->key; } diff --git a/tests/Integration/Api/Application/EggControllerTest.php b/tests/Integration/Api/Application/EggControllerTest.php index 62ab2422f..14a41cd6a 100644 --- a/tests/Integration/Api/Application/EggControllerTest.php +++ b/tests/Integration/Api/Application/EggControllerTest.php @@ -48,7 +48,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase $this->assertSame( $expected, $actual, - 'Unable to find JSON fragment: '.PHP_EOL.PHP_EOL."[$expected]".PHP_EOL.PHP_EOL.'within'.PHP_EOL.PHP_EOL."[$actual]." + 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[$expected]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[$actual]." ); } } @@ -60,7 +60,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase { $egg = Egg::query()->findOrFail(1); - $response = $this->getJson('/api/application/eggs/'.$egg->id); + $response = $this->getJson('/api/application/eggs/' . $egg->id); $response->assertStatus(Response::HTTP_OK); $response->assertJsonStructure([ 'object', @@ -82,7 +82,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase { $egg = Egg::query()->findOrFail(1); - $response = $this->getJson('/api/application/eggs/'.$egg->id.'?include=servers,variables'); + $response = $this->getJson('/api/application/eggs/' . $egg->id . '?include=servers,variables'); $response->assertStatus(Response::HTTP_OK); $response->assertJsonStructure([ 'object', diff --git a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php index 4ef873c43..24f3996eb 100644 --- a/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php +++ b/tests/Integration/Api/Application/Users/ExternalUserControllerTest.php @@ -16,7 +16,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase { $user = User::factory()->create(['external_id' => Str::random()]); - $response = $this->getJson('/api/application/users/external/'.$user->external_id); + $response = $this->getJson('/api/application/users/external/' . $user->external_id); $response->assertStatus(Response::HTTP_OK); $response->assertJsonCount(2); $response->assertJsonStructure([ @@ -64,7 +64,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase $user = User::factory()->create(['external_id' => Str::random()]); $this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); - $response = $this->getJson('/api/application/users/external/'.$user->external_id); + $response = $this->getJson('/api/application/users/external/' . $user->external_id); $this->assertAccessDeniedJson($response); } } diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 04ba5c2e6..6787ff1f4 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -89,7 +89,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase { $user = User::factory()->create(); - $response = $this->getJson('/api/application/users/'.$user->id); + $response = $this->getJson('/api/application/users/' . $user->id); $response->assertStatus(Response::HTTP_OK); $response->assertJsonCount(2); $response->assertJsonStructure([ @@ -124,7 +124,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $user = User::factory()->create(); $server = $this->createServerModel(['user_id' => $user->id]); - $response = $this->getJson('/api/application/users/'.$user->id.'?include=servers'); + $response = $this->getJson('/api/application/users/' . $user->id . '?include=servers'); $response->assertStatus(Response::HTTP_OK); $response->assertJsonCount(2); $response->assertJsonStructure([ @@ -157,7 +157,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $user = User::factory()->create(); $this->createServerModel(['user_id' => $user->id]); - $response = $this->getJson('/api/application/users/'.$user->id.'?include=servers'); + $response = $this->getJson('/api/application/users/' . $user->id . '?include=servers'); $response->assertStatus(Response::HTTP_OK); $response->assertJsonCount(2)->assertJsonCount(1, 'attributes.relationships'); $response->assertJsonStructure([ @@ -199,7 +199,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $user = User::factory()->create(); $this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); - $response = $this->getJson('/api/application/users/'.$user->id); + $response = $this->getJson('/api/application/users/' . $user->id); $this->assertAccessDeniedJson($response); } @@ -242,7 +242,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase { $user = User::factory()->create(); - $response = $this->patchJson('/api/application/users/'.$user->id, [ + $response = $this->patchJson('/api/application/users/' . $user->id, [ 'username' => 'new.test.name', 'email' => 'new@emailtest.com', 'first_name' => $user->name_first, @@ -272,7 +272,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $user = User::factory()->create(); $this->assertDatabaseHas('users', ['id' => $user->id]); - $response = $this->delete('/api/application/users/'.$user->id); + $response = $this->delete('/api/application/users/' . $user->id); $response->assertStatus(Response::HTTP_NO_CONTENT); $this->assertDatabaseMissing('users', ['id' => $user->id]); diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index 38ce80fa9..ccca6818d 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -28,7 +28,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase 'first_name' => $user->name_first, 'last_name' => $user->name_last, 'language' => 'en', - 'image' => 'https://gravatar.com/avatar/'.md5(Str::lower($user->email)), + 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)), 'admin' => false, 'root_admin' => false, '2fa_enabled' => false, @@ -47,7 +47,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase $user = User::factory()->create(); $response = $this->actingAs($user)->putJson('/api/client/account/email', [ - 'email' => $email = Str::random().'@example.com', + 'email' => $email = Str::random() . '@example.com', 'password' => 'password', ]); diff --git a/tests/Integration/Api/Client/ApiKeyControllerTest.php b/tests/Integration/Api/Client/ApiKeyControllerTest.php index 27662a173..462875c59 100644 --- a/tests/Integration/Api/Client/ApiKeyControllerTest.php +++ b/tests/Integration/Api/Client/ApiKeyControllerTest.php @@ -83,7 +83,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase { $ips = []; for ($i = 0; $i < 100; $i++) { - $ips[] = '127.0.0.'.$i; + $ips[] = '127.0.0.' . $i; } $this->actingAs(User::factory()->create()) @@ -162,7 +162,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase 'key_type' => ApiKey::TYPE_ACCOUNT, ]); - $response = $this->actingAs($user)->delete('/api/client/account/api-keys/'.$key->identifier); + $response = $this->actingAs($user)->delete('/api/client/account/api-keys/' . $key->identifier); $response->assertStatus(Response::HTTP_NO_CONTENT); $this->assertDatabaseMissing('api_keys', ['id' => $key->id]); @@ -205,7 +205,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase ]); $this->actingAs($user) - ->deleteJson('/api/client/account/api-keys/'.$key->identifier) + ->deleteJson('/api/client/account/api-keys/' . $key->identifier) ->assertNotFound(); $this->assertDatabaseHas('api_keys', ['id' => $key->id]); @@ -226,7 +226,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase ]); $this->actingAs($user) - ->deleteJson('/api/client/account/api-keys/'.$key->identifier) + ->deleteJson('/api/client/account/api-keys/' . $key->identifier) ->assertNotFound(); $this->assertDatabaseHas('api_keys', ['id' => $key->id]); diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index 86e9a202d..70db04614 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -69,7 +69,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase throw new \InvalidArgumentException(sprintf('Cannot create link for Model of type %s', class_basename($model))); } - return $link.($append ? '/'.ltrim($append, '/') : ''); + return $link . ($append ? '/' . ltrim($append, '/') : ''); } /** diff --git a/tests/Integration/Api/Client/ClientControllerTest.php b/tests/Integration/Api/Client/ClientControllerTest.php index 4e5e26b27..e4059f694 100644 --- a/tests/Integration/Api/Client/ClientControllerTest.php +++ b/tests/Integration/Api/Client/ClientControllerTest.php @@ -298,7 +298,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase $this->createServerModel(['user_id' => $users[1]->id]); $this->createServerModel(['user_id' => $users[2]->id]); - $response = $this->actingAs($users[0])->getJson('/api/client?type='.$type); + $response = $this->actingAs($users[0])->getJson('/api/client?type=' . $type); $response->assertOk(); $response->assertJsonCount(0, 'data'); diff --git a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php index f1d93f8ad..6cd798e16 100644 --- a/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Allocation/AllocationAuthorizationTest.php @@ -30,20 +30,20 @@ class AllocationAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the allocation for the same // server that the API user is the owner of. - $response = $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/'.$allocation1->id.$endpoint)); + $response = $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation1->id . $endpoint)); $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); // This request fails because the allocation is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/'.$allocation2->id.$endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation2->id . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the allocations being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/'.$allocation2->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/'.$allocation3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/'.$allocation3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/'.$allocation3->id.$endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound(); } public static function methodDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php index c91c2e3a1..472364d78 100644 --- a/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Backup/BackupAuthorizationTest.php @@ -38,20 +38,20 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the backup for the same // server that the API user is the owner of. - $this->actingAs($user)->json($method, $this->link($server1, '/backups/'.$backup1->uuid.$endpoint)) + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup1->uuid . $endpoint)) ->assertStatus($method === 'DELETE' ? 204 : 200); // This request fails because the backup is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, '/backups/'.$backup2->uuid.$endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup2->uuid . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the backup being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, '/backups/'.$backup2->uuid.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, '/backups/'.$backup3->uuid.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, '/backups/'.$backup3->uuid.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, '/backups/'.$backup3->uuid.$endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup2->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound(); } public static function methodDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php index 2c8320812..b95778104 100644 --- a/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Database/DatabaseAuthorizationTest.php @@ -40,20 +40,20 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the database for the same // server that the API user is the owner of. - $this->actingAs($user)->json($method, $this->link($server1, '/databases/'.$database1->id.$endpoint)) + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $database1->id . $endpoint)) ->assertStatus($method === 'DELETE' ? 204 : 200); // This request fails because the database is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, '/databases/'.$database2->id.$endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $database2->id . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the database being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, '/databases/'.$database2->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, '/databases/'.$database3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, '/databases/'.$database3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, '/databases/'.$database3->id.$endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $database2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/databases/' . $database3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/databases/' . $database3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/databases/' . $database3->id . $endpoint))->assertNotFound(); } public static function methodDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php index 5900e67f2..7d019178b 100644 --- a/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/GetServerSchedulesTest.php @@ -47,13 +47,13 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase $response->assertJsonCount(1, 'data'); } - $response->assertJsonCount(1, $prefix.'attributes.relationships.tasks.data'); + $response->assertJsonCount(1, $prefix . 'attributes.relationships.tasks.data'); - $response->assertJsonPath($prefix.'object', Schedule::RESOURCE_NAME); - $response->assertJsonPath($prefix.'attributes.relationships.tasks.data.0.object', Task::RESOURCE_NAME); + $response->assertJsonPath($prefix . 'object', Schedule::RESOURCE_NAME); + $response->assertJsonPath($prefix . 'attributes.relationships.tasks.data.0.object', Task::RESOURCE_NAME); - $this->assertJsonTransformedWith($response->json($prefix.'attributes'), $schedule); - $this->assertJsonTransformedWith($response->json($prefix.'attributes.relationships.tasks.data.0.attributes'), $task); + $this->assertJsonTransformedWith($response->json($prefix . 'attributes'), $schedule); + $this->assertJsonTransformedWith($response->json($prefix . 'attributes.relationships.tasks.data.0.attributes'), $task); } /** diff --git a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php index 011187e71..b6777a748 100644 --- a/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/ScheduleAuthorizationTest.php @@ -38,20 +38,20 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase // This is the only valid call for this test, accessing the schedule for the same // server that the API user is the owner of. - $response = $this->actingAs($user)->json($method, $this->link($server1, '/schedules/'.$schedule1->id.$endpoint)); + $response = $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule1->id . $endpoint)); $this->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422); // This request fails because the schedule is valid for that server but the user // making the request is not authorized to perform that action. - $this->actingAs($user)->json($method, $this->link($server2, '/schedules/'.$schedule2->id.$endpoint))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule2->id . $endpoint))->assertForbidden(); // Both of these should report a 404 error due to the schedules being linked to // servers that are not the same as the server in the request, or are assigned // to a server for which the user making the request has no access to. - $this->actingAs($user)->json($method, $this->link($server1, '/schedules/'.$schedule2->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server1, '/schedules/'.$schedule3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server2, '/schedules/'.$schedule3->id.$endpoint))->assertNotFound(); - $this->actingAs($user)->json($method, $this->link($server3, '/schedules/'.$schedule3->id.$endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule2->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server1, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound(); } public static function methodDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php index b11d06346..88cc6ed6f 100644 --- a/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php +++ b/tests/Integration/Api/Client/Server/Startup/GetStartupAndVariablesTest.php @@ -33,7 +33,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase ])->save(); $server = $server->refresh(); - $response = $this->actingAs($user)->getJson($this->link($server).'/startup'); + $response = $this->actingAs($user)->getJson($this->link($server) . '/startup'); $response->assertOk(); $response->assertJsonPath('meta.startup_command', 'java bungeecord.jar --version [hidden]'); @@ -52,10 +52,10 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase public function testStartupDataIsNotReturnedWithoutPermission(): void { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->getJson($this->link($server).'/startup')->assertForbidden(); + $this->actingAs($user)->getJson($this->link($server) . '/startup')->assertForbidden(); $user2 = User::factory()->create(); - $this->actingAs($user2)->getJson($this->link($server).'/startup')->assertNotFound(); + $this->actingAs($user2)->getJson($this->link($server) . '/startup')->assertNotFound(); } public static function permissionsDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php index c5471ec11..e9c8af97c 100644 --- a/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php +++ b/tests/Integration/Api/Client/Server/Startup/UpdateStartupVariableTest.php @@ -23,7 +23,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase 'startup' => 'java {{SERVER_JARFILE}} --version {{BUNGEE_VERSION}}', ])->save(); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'BUNGEE_VERSION', 'value' => '1.2.3', ]); @@ -32,7 +32,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $response->assertJsonPath('errors.0.code', 'ValidationException'); $response->assertJsonPath('errors.0.detail', 'The value may only contain letters and numbers.'); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'BUNGEE_VERSION', 'value' => '123', ]); @@ -62,7 +62,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $server->fill(['egg_id' => $egg->id])->save(); $server->refresh(); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'BUNGEE_VERSION', 'value' => '123', ]); @@ -71,7 +71,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $response->assertJsonPath('errors.0.code', 'BadRequestHttpException'); $response->assertJsonPath('errors.0.detail', 'The environment variable you are trying to edit does not exist.'); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'SERVER_JARFILE', 'value' => 'server2.jar', ]); @@ -100,7 +100,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $server->refresh(); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'SERVER_JARFILE', 'value' => 'server2.jar', ]); @@ -125,7 +125,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase $server->fill(['egg_id' => $egg->id])->save(); $server->refresh(); - $response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ + $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [ 'key' => 'BUNGEE_VERSION', 'value' => '', ]); @@ -141,10 +141,10 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase public function testStartupVariableCannotBeUpdatedIfNotUserViewable(): void { [$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); - $this->actingAs($user)->putJson($this->link($server).'/startup/variable')->assertForbidden(); + $this->actingAs($user)->putJson($this->link($server) . '/startup/variable')->assertForbidden(); $user2 = User::factory()->create(); - $this->actingAs($user2)->putJson($this->link($server).'/startup/variable')->assertNotFound(); + $this->actingAs($user2)->putJson($this->link($server) . '/startup/variable')->assertNotFound(); } public static function permissionsDataProvider(): array diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index f9c6595f4..7175a7cc7 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -23,7 +23,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount($permissions); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email(), 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -60,7 +60,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase Permission::ACTION_CONTROL_CONSOLE, ]); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $this->faker->email(), 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -80,9 +80,9 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $email = str_repeat(Str::random(35), 7).'@gmail.com'; // 255 is the hard limit for the column in MySQL. + $email = str_repeat(Str::random(35), 7) . '@gmail.com'; // 255 is the hard limit for the column in MySQL. - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -91,8 +91,8 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ - 'email' => $email.'.au', + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ + 'email' => $email . '.au', 'permissions' => [ Permission::ACTION_USER_CREATE, ], @@ -114,7 +114,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase /** @var \App\Models\User $existing */ $existing = User::factory()->create(['email' => $this->faker->email()]); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $existing->email, 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -134,7 +134,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email = $this->faker->email(), 'permissions' => [ Permission::ACTION_USER_CREATE, @@ -143,7 +143,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase $response->assertOk(); - $response = $this->actingAs($user)->postJson($this->link($server).'/users', [ + $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, 'permissions' => [ Permission::ACTION_USER_CREATE, diff --git a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php index 21067ad1b..bbd97f4b3 100644 --- a/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/DeleteSubuserTest.php @@ -31,7 +31,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $real = Uuid::uuid4()->toString(); // Generate a UUID that lines up with a user in the database if it were to be cast to an int. - $uuid = $differentUser->id.substr($real, strlen((string) $differentUser->id)); + $uuid = $differentUser->id . substr($real, strlen((string) $differentUser->id)); /** @var \App\Models\User $subuser */ $subuser = User::factory()->create(['uuid' => $uuid]); @@ -44,11 +44,11 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); - $this->actingAs($user)->deleteJson($this->link($server)."/users/$subuser->uuid")->assertNoContent(); + $this->actingAs($user)->deleteJson($this->link($server) . "/users/$subuser->uuid")->assertNoContent(); // Try the same test, but this time with a UUID that if cast to an int (shouldn't) line up with // anything in the database. - $uuid = '18180000'.substr(Uuid::uuid4()->toString(), 8); + $uuid = '18180000' . substr(Uuid::uuid4()->toString(), 8); /** @var \App\Models\User $subuser */ $subuser = User::factory()->create(['uuid' => $uuid]); @@ -60,6 +60,6 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase $mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); - $this->actingAs($user)->deleteJson($this->link($server)."/users/$subuser->uuid")->assertNoContent(); + $this->actingAs($user)->deleteJson($this->link($server) . "/users/$subuser->uuid")->assertNoContent(); } } diff --git a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php index 03bd42ee9..ab844d0b3 100644 --- a/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/SubuserAuthorizationTest.php @@ -41,12 +41,12 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase } // This route is acceptable since they're accessing a subuser on their own server. - $this->actingAs($user)->json($method, $this->link($server1, '/users/'.$internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200)); + $this->actingAs($user)->json($method, $this->link($server1, '/users/' . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200)); // This route can be revealed since the subuser belongs to the correct server, but // errors out with a 403 since $user does not have the right permissions for this. - $this->actingAs($user)->json($method, $this->link($server2, '/users/'.$internal->uuid))->assertForbidden(); - $this->actingAs($user)->json($method, $this->link($server3, '/users/'.$internal->uuid))->assertNotFound(); + $this->actingAs($user)->json($method, $this->link($server2, '/users/' . $internal->uuid))->assertForbidden(); + $this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound(); } public static function methodDataProvider(): array diff --git a/tests/Integration/Api/Daemon/DaemonAuthenticateTest.php b/tests/Integration/Api/Daemon/DaemonAuthenticateTest.php index 1dde92284..b18b3e5e8 100644 --- a/tests/Integration/Api/Daemon/DaemonAuthenticateTest.php +++ b/tests/Integration/Api/Daemon/DaemonAuthenticateTest.php @@ -69,7 +69,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase $this->expectException(AccessDeniedHttpException::class); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); - $this->request->expects('bearerToken')->withNoArgs()->andReturn($node->daemon_token_id.'.random_string_123'); + $this->request->expects('bearerToken')->withNoArgs()->andReturn($node->daemon_token_id . '.random_string_123'); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); } @@ -98,7 +98,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase $node->save(); $this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); - $this->request->expects('bearerToken')->withNoArgs()->andReturn($node->daemon_token_id.'.the_same'); + $this->request->expects('bearerToken')->withNoArgs()->andReturn($node->daemon_token_id . '.the_same'); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions()); $this->assertRequestHasAttribute('node'); diff --git a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php index da340cbb4..3236266dc 100644 --- a/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php +++ b/tests/Integration/Api/Remote/SftpAuthenticationControllerTest.php @@ -143,7 +143,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase $this->setAuthorization($server->node); $this->postJson('/api/remote/sftp/auth', [ - 'username' => $user->username.'.'.$server->uuid_short, + 'username' => $user->username . '.' . $server->uuid_short, 'password' => 'foobar', ]) ->assertForbidden() @@ -173,7 +173,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase $this->setAuthorization($server->node); $data = [ - 'username' => $user->username.'.'.$server->uuid_short, + 'username' => $user->username . '.' . $server->uuid_short, 'password' => 'foobar', ]; @@ -188,7 +188,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase ->assertJsonPath('permissions.0', '*'); $this->setAuthorization(); - $data['username'] = $user->username.'.'.$this->server->uuid_short; + $data['username'] = $user->username . '.' . $this->server->uuid_short; $this->post('/api/remote/sftp/auth', $data) ->assertOk() @@ -220,7 +220,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase */ protected function getUsername(bool $long = false): string { - return $this->user->username.'.'.($long ? $this->server->uuid : $this->server->uuid_short); + return $this->user->username . '.' . ($long ? $this->server->uuid : $this->server->uuid_short); } /** @@ -230,6 +230,6 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase { $node = $node ?? $this->server->node; - $this->withHeader('Authorization', 'Bearer '.$node->daemon_token_id.'.'.$node->daemon_token); + $this->withHeader('Authorization', 'Bearer ' . $node->daemon_token_id . '.' . $node->daemon_token); } } diff --git a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php index b82aa61ab..cbd263501 100644 --- a/tests/Integration/Http/Controllers/Admin/UserControllerTest.php +++ b/tests/Integration/Http/Controllers/Admin/UserControllerTest.php @@ -21,8 +21,8 @@ class UserControllerTest extends IntegrationTestCase { $unique = Str::random(); $users = [ - User::factory()->create(['username' => $unique.'_1']), - User::factory()->create(['username' => $unique.'_2']), + User::factory()->create(['username' => $unique . '_1']), + User::factory()->create(['username' => $unique . '_2']), ]; $servers = [ @@ -38,7 +38,7 @@ class UserControllerTest extends IntegrationTestCase /** @var \App\Http\Controllers\Admin\UserController $controller */ $controller = $this->app->make(UserController::class); - $request = Request::create('/admin/users?filter[username]='.$unique); + $request = Request::create('/admin/users?filter[username]=' . $unique); $this->app->instance(Request::class, $request); $data = $controller->index($request)->getData(); diff --git a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php index 1584c2000..060ed9f10 100644 --- a/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php +++ b/tests/Integration/Services/Databases/DatabaseManagementServiceTest.php @@ -29,7 +29,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase { $this->assertSame('s1_example', DatabaseManagementService::generateUniqueDatabaseName('example', 1)); $this->assertSame('s123_something_else', DatabaseManagementService::generateUniqueDatabaseName('something_else', 123)); - $this->assertSame('s123_'.str_repeat('a', 43), DatabaseManagementService::generateUniqueDatabaseName(str_repeat('a', 100), 123)); + $this->assertSame('s123_' . str_repeat('a', 43), DatabaseManagementService::generateUniqueDatabaseName(str_repeat('a', 100), 123)); } /** diff --git a/tests/Traits/Http/RequestMockHelpers.php b/tests/Traits/Http/RequestMockHelpers.php index d4da1bb23..46a71e26a 100644 --- a/tests/Traits/Http/RequestMockHelpers.php +++ b/tests/Traits/Http/RequestMockHelpers.php @@ -68,7 +68,7 @@ trait RequestMockHelpers { $this->request = m::mock($this->requestMockClass); if (!$this->request instanceof Request) { - throw new \InvalidArgumentException('Request mock class must be an instance of '.Request::class.' when mocked.'); + throw new \InvalidArgumentException('Request mock class must be an instance of ' . Request::class . ' when mocked.'); } $this->request->attributes = new ParameterBag(); diff --git a/tests/Traits/MocksUuids.php b/tests/Traits/MocksUuids.php index 8b6d2b0a8..8cfa4b7ce 100644 --- a/tests/Traits/MocksUuids.php +++ b/tests/Traits/MocksUuids.php @@ -19,7 +19,7 @@ trait MocksUuids public function setKnownUuidFactory(): void { $uuid = Uuid::fromString($this->getKnownUuid()); - $factoryMock = m::mock(UuidFactory::class.'[uuid4]', [ + $factoryMock = m::mock(UuidFactory::class . '[uuid4]', [ 'uuid4' => $uuid, ]);