Revert "Add concat_space rule"

This reverts commit 96acd268bee7005fe1691b572a4674575604d437.
This commit is contained in:
Lance Pioch 2024-10-19 21:14:41 -04:00
parent 466f9f7edc
commit deb6603840
105 changed files with 272 additions and 271 deletions

View File

@ -16,7 +16,7 @@ class AppSettingsCommand extends Command
$path = base_path('.env'); $path = base_path('.env');
if (!file_exists($path)) { if (!file_exists($path)) {
$this->comment('Copying example .env file'); $this->comment('Copying example .env file');
copy($path.'.example', $path); copy($path . '.example', $path);
} }
if (!config('app.key')) { if (!config('app.key')) {

View File

@ -44,7 +44,7 @@ class EmailSettingsCommand extends Command
env('MAIL_MAILER', env('MAIL_DRIVER', 'smtp')), 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)) { if (method_exists($this, $method)) {
$this->{$method}(); $this->{$method}();
} }

View File

@ -19,7 +19,7 @@ class QueueWorkerServiceCommand extends Command
public function handle(): void public function handle(): void
{ {
$serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue'); $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); $fileExists = file_exists($path);
if ($fileExists && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { 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) { if ($fileExists) {
$result = Process::run("systemctl restart $serviceName.service"); $result = Process::run("systemctl restart $serviceName.service");
if ($result->failed()) { if ($result->failed()) {
$this->error('Error restarting service: '.$result->errorOutput()); $this->error('Error restarting service: ' . $result->errorOutput());
return; return;
} }
@ -74,7 +74,7 @@ WantedBy=multi-user.target
} else { } else {
$result = Process::run("systemctl enable --now $serviceName.service"); $result = Process::run("systemctl enable --now $serviceName.service");
if ($result->failed()) { if ($result->failed()) {
$this->error('Error enabling service: '.$result->errorOutput()); $this->error('Error enabling service: ' . $result->errorOutput());
return; return;
} }

View File

@ -50,7 +50,7 @@ class PruneImagesCommand extends Command
$count = count($response['ImagesDeleted']); $count = count($response['ImagesDeleted']);
$useBinaryPrefix = config('panel.use_binary_prefix'); $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})"); $this->info("Node {$node->id}: Cleaned up {$count} dangling docker images. ({$space})");
} catch (Exception $exception) { } catch (Exception $exception) {

View File

@ -67,7 +67,7 @@ class ProcessRunnableCommand extends Command
} catch (\Throwable|\Exception $exception) { } catch (\Throwable|\Exception $exception) {
logger()->error($exception, ['schedule_id' => $schedule->id]); 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());
} }
} }
} }

View File

@ -40,7 +40,7 @@ class UpgradeCommand extends Command
} }
if (version_compare(PHP_VERSION, '7.4.0') < 0) { 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'; $user = 'www-data';
@ -125,7 +125,7 @@ class UpgradeCommand extends Command
$command[] = '--no-dev'; $command[] = '--no-dev';
} }
$this->line('$upgrader> '.implode(' ', $command)); $this->line('$upgrader> ' . implode(' ', $command));
$process = new Process($command); $process = new Process($command);
$process->setTimeout(10 * 60); $process->setTimeout(10 * 60);
$process->run(function ($type, $buffer) { $process->run(function ($type, $buffer) {
@ -134,7 +134,7 @@ class UpgradeCommand extends Command
}); });
/** @var \Illuminate\Foundation\Application $app */ /** @var \Illuminate\Foundation\Application $app */
$app = require __DIR__.'/../../../bootstrap/app.php'; $app = require __DIR__ . '/../../../bootstrap/app.php';
/** @var \App\Console\Kernel $kernel */ /** @var \App\Console\Kernel $kernel */
$kernel = $app->make(Kernel::class); $kernel = $app->make(Kernel::class);
$kernel->bootstrap(); $kernel->bootstrap();
@ -192,6 +192,6 @@ class UpgradeCommand extends Command
return $this->option('url'); 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');
} }
} }

View File

@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function commands(): void protected function commands(): void
{ {
$this->load(__DIR__.'/Commands'); $this->load(__DIR__ . '/Commands');
} }
/** /**

View File

@ -108,7 +108,7 @@ class Handler extends ExceptionHandler
$exception->getLine() $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, 'source_field' => $field,
'rule' => str_replace(self::PANEL_RULE_STRING, 'p_', Arr::get( 'rule' => str_replace(self::PANEL_RULE_STRING, 'p_', Arr::get(
$codes, $codes,
str_replace('.', '_', $field).'.'.$key str_replace('.', '_', $field) . '.' . $key
)), )),
]; ];

View File

@ -74,7 +74,7 @@ class BackupManager
return $this->callCustomCreator($config); return $this->callCustomCreator($config);
} }
$adapterMethod = 'create'.Str::studly($adapter).'Adapter'; $adapterMethod = 'create' . Str::studly($adapter) . 'Adapter';
if (method_exists($this, $adapterMethod)) { if (method_exists($this, $adapterMethod)) {
$instance = $this->{$adapterMethod}($config); $instance = $this->{$adapterMethod}($config);

View File

@ -21,7 +21,7 @@ class DynamicDatabaseConnection
$host = DatabaseHost::query()->findOrFail($host); $host = DatabaseHost::query()->findOrFail($host);
} }
config()->set('database.connections.'.$connection, [ config()->set('database.connections.' . $connection, [
'driver' => self::DB_DRIVER, 'driver' => self::DB_DRIVER,
'host' => $host->host, 'host' => $host->host,
'port' => $host->port, 'port' => $host->port,

View File

@ -6,16 +6,16 @@ class Theme
{ {
public function js($path): string public function js($path): string
{ {
return sprintf('<script src="%s"></script>'.PHP_EOL, $this->getUrl($path)); return sprintf('<script src="%s"></script>' . PHP_EOL, $this->getUrl($path));
} }
public function css($path): string public function css($path): string
{ {
return sprintf('<link media="all" type="text/css" rel="stylesheet" href="%s"/>'.PHP_EOL, $this->getUrl($path)); return sprintf('<link media="all" type="text/css" rel="stylesheet" href="%s"/>' . PHP_EOL, $this->getUrl($path));
} }
protected function getUrl($path): string protected function getUrl($path): string
{ {
return '/themes/panel/'.ltrim($path, '/'); return '/themes/panel/' . ltrim($path, '/');
} }
} }

View File

@ -21,12 +21,12 @@ class CompletedStep
->label(new HtmlString('Run the following command to setup your crontab. Note that <code>www-data</code> is your webserver user. On some systems this username might be different!')) ->label(new HtmlString('Run the following command to setup your crontab. Note that <code>www-data</code> is your webserver user. On some systems this username might be different!'))
->disabled() ->disabled()
->hintAction(CopyAction::make()) ->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') TextInput::make('queueService')
->label(new HtmlString('To setup the queue worker service you simply have to run the following command.')) ->label(new HtmlString('To setup the queue worker service you simply have to run the following command.'))
->disabled() ->disabled()
->hintAction(CopyAction::make()) ->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('') Placeholder::make('')
->content('After you finished these two last tasks you can click on "Finish" and use your new panel! Have fun!'), ->content('After you finished these two last tasks you can click on "Finish" and use your new panel! Have fun!'),
]); ]);

View File

@ -18,12 +18,12 @@ class RequirementsStep
$fields = [ $fields = [
Section::make('PHP Version') Section::make('PHP Version')
->description(self::MIN_PHP_VERSION.' or newer') ->description(self::MIN_PHP_VERSION . ' or newer')
->icon($correctPhpVersion ? 'tabler-check' : 'tabler-x') ->icon($correctPhpVersion ? 'tabler-check' : 'tabler-x')
->iconColor($correctPhpVersion ? 'success' : 'danger') ->iconColor($correctPhpVersion ? 'success' : 'danger')
->schema([ ->schema([
Placeholder::make('') 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.') ->content('All needed PHP Extensions are installed.')
->visible($allExtensionsInstalled), ->visible($allExtensionsInstalled),
Placeholder::make('') 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), ->visible(!$allExtensionsInstalled),
]); ]);
@ -68,7 +68,7 @@ class RequirementsStep
->content('All Folders have the correct permissions.') ->content('All Folders have the correct permissions.')
->visible($correctFolderPermissions), ->visible($correctFolderPermissions),
Placeholder::make('') 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), ->visible(!$correctFolderPermissions),
]); ]);

View File

@ -24,7 +24,7 @@ class ListApiKeys extends ListRecords
TextColumn::make('key') TextColumn::make('key')
->copyable() ->copyable()
->icon('tabler-clipboard-text') ->icon('tabler-clipboard-text')
->state(fn (ApiKey $key) => $key->identifier.$key->token), ->state(fn (ApiKey $key) => $key->identifier . $key->token),
TextColumn::make('memo') TextColumn::make('memo')
->label('Description') ->label('Description')

View File

@ -37,7 +37,7 @@ class DatabasesRelationManager extends RelationManager
TextInput::make('JDBC') TextInput::make('JDBC')
->label('JDBC Connection String') ->label('JDBC Connection String')
->columnSpanFull() ->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 protected function rotatePassword(DatabasePasswordService $service, Database $database, $set, $get): void
{ {
$newPassword = $service->handle($database); $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('password', $newPassword);
$set('JDBC', $jdbcString); $set('JDBC', $jdbcString);

View File

@ -249,7 +249,7 @@ class EditEgg extends EditRecord
->color('primary') ->color('primary')
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
echo $service->handle($egg->id); echo $service->handle($egg->id);
}, 'egg-'.$egg->getKebabName().'.json')) }, 'egg-' . $egg->getKebabName() . '.json'))
->authorize(fn () => auth()->user()->can('export egg')), ->authorize(fn () => auth()->user()->can('export egg')),
Actions\Action::make('importEgg') Actions\Action::make('importEgg')
->label('Import') ->label('Import')

View File

@ -55,7 +55,7 @@ class ListEggs extends ListRecords
->color('primary') ->color('primary')
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
echo $service->handle($egg->id); echo $service->handle($egg->id);
}, 'egg-'.$egg->getKebabName().'.json')) }, 'egg-' . $egg->getKebabName() . '.json'))
->authorize(fn () => auth()->user()->can('export egg')), ->authorize(fn () => auth()->user()->can('export egg')),
Action::make('update') Action::make('update')
->icon('tabler-cloud-download') ->icon('tabler-cloud-download')

View File

@ -76,8 +76,8 @@ class NodeCpuChart extends ChartWidget
$threads = $node->systemInformation()['cpu_count'] ?? 0; $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); $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;
} }
} }

View File

@ -75,13 +75,13 @@ class NodeMemoryChart extends ChartWidget
$totalMemory = collect(cache()->get("nodes.$node->id.memory_total"))->last(); $totalMemory = collect(cache()->get("nodes.$node->id.memory_total"))->last();
$used = config('panel.use_binary_prefix') $used = config('panel.use_binary_prefix')
? Number::format($latestMemoryUsed / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language).' GiB' ? 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 / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
$total = config('panel.use_binary_prefix') $total = config('panel.use_binary_prefix')
? Number::format($totalMemory / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language).' GiB' ? 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 / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
return 'Memory - '.$used.' Of '.$total; return 'Memory - ' . $used . ' Of ' . $total;
} }
} }

View File

@ -40,12 +40,12 @@ class RoleResource extends Resource
$options = []; $options = [];
foreach (RolePermissionPrefixes::cases() as $prefix) { 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)) { if (array_key_exists($model->value, Role::MODEL_SPECIFIC_PERMISSIONS)) {
foreach (Role::MODEL_SPECIFIC_PERMISSIONS[$model->value] as $permission) { 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 = []; $options = [];
foreach ($prefixes as $prefix) { foreach ($prefixes as $prefix) {
$options[$prefix.' '.strtolower($model)] = Str::headline($prefix); $options[$prefix . ' ' . strtolower($model)] = Str::headline($prefix);
} }
$permissions[] = self::makeSection($model, $options); $permissions[] = self::makeSection($model, $options);
@ -88,10 +88,10 @@ class RoleResource extends Resource
{ {
$icon = null; $icon = null;
if (class_exists('\App\Filament\Resources\\'.$model.'Resource')) { if (class_exists('\App\Filament\Resources\\' . $model . 'Resource')) {
$icon = ('\App\Filament\Resources\\'.$model.'Resource')::getNavigationIcon(); $icon = ('\App\Filament\Resources\\' . $model . 'Resource')::getNavigationIcon();
} elseif (class_exists('\App\Filament\Pages\\'.$model)) { } elseif (class_exists('\App\Filament\Pages\\' . $model)) {
$icon = ('\App\Filament\Pages\\'.$model)::getNavigationIcon(); $icon = ('\App\Filament\Pages\\' . $model)::getNavigationIcon();
} }
return Section::make(Str::headline(Str::plural($model))) return Section::make(Str::headline(Str::plural($model)))
@ -101,11 +101,11 @@ class RoleResource extends Resource
->icon($icon) ->icon($icon)
->headerActions([ ->headerActions([
Action::make('count') Action::make('count')
->label(fn (Get $get) => count($get(strtolower($model).'_list'))) ->label(fn (Get $get) => count($get(strtolower($model) . '_list')))
->badge(), ->badge(),
]) ])
->schema([ ->schema([
CheckboxList::make(strtolower($model).'_list') CheckboxList::make(strtolower($model) . '_list')
->label('') ->label('')
->options($options) ->options($options)
->columns() ->columns()

View File

@ -70,14 +70,14 @@ class CreateServer extends CreateRecord
->prefixIcon('tabler-server') ->prefixIcon('tabler-server')
->label('Name') ->label('Name')
->suffixAction(Forms\Components\Actions\Action::make('random') ->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) { ->action(function (Set $set, Get $get) {
$egg = Egg::find($get('egg_id')); $egg = Egg::find($get('egg_id'));
$prefix = $egg ? str($egg->name)->lower()->kebab().'-' : ''; $prefix = $egg ? str($egg->name)->lower()->kebab() . '-' : '';
$word = (new RandomWordService())->word(); $word = (new RandomWordService())->word();
$set('name', $prefix.$word); $set('name', $prefix . $word);
})) }))
->columnSpan([ ->columnSpan([
'default' => 2, 'default' => 2,
@ -101,7 +101,7 @@ class CreateServer extends CreateRecord
]) ])
->relationship('user', 'username') ->relationship('user', 'username')
->searchable(['username', 'email']) ->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([ ->createOptionForm([
TextInput::make('username') TextInput::make('username')
->alphaNum() ->alphaNum()
@ -163,7 +163,7 @@ class CreateServer extends CreateRecord
$set('allocation_additional.needstobeastringhere.extra_allocations', null); $set('allocation_additional.needstobeastringhere.extra_allocations', null);
}) })
->getOptionLabelFromRecordUsing( ->getOptionLabelFromRecordUsing(
fn (Allocation $allocation) => "$allocation->ip:$allocation->port". fn (Allocation $allocation) => "$allocation->ip:$allocation->port" .
($allocation->ip_alias ? " ($allocation->ip_alias)" : '') ($allocation->ip_alias ? " ($allocation->ip_alias)" : '')
) )
->placeholder(function (Get $get) { ->placeholder(function (Get $get) {
@ -293,7 +293,7 @@ class CreateServer extends CreateRecord
->disabled(fn (Get $get) => $get('../../node_id') === null) ->disabled(fn (Get $get) => $get('../../node_id') === null)
->searchable(['ip', 'port', 'ip_alias']) ->searchable(['ip', 'port', 'ip_alias'])
->getOptionLabelFromRecordUsing( ->getOptionLabelFromRecordUsing(
fn (Allocation $allocation) => "$allocation->ip:$allocation->port". fn (Allocation $allocation) => "$allocation->ip:$allocation->port" .
($allocation->ip_alias ? " ($allocation->ip_alias)" : '') ($allocation->ip_alias ? " ($allocation->ip_alias)" : '')
) )
->placeholder('Select additional Allocations') ->placeholder('Select additional Allocations')
@ -498,7 +498,7 @@ class CreateServer extends CreateRecord
->hintIcon('tabler-code') ->hintIcon('tabler-code')
->label(fn (Get $get) => $get('name')) ->label(fn (Get $get) => $get('name'))
->hintIconTooltip(fn (Get $get) => implode('|', $get('rules'))) ->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')) ->helperText(fn (Get $get) => empty($get('description')) ? '—' : $get('description'))
->afterStateUpdated(function (Set $set, Get $get, $state) { ->afterStateUpdated(function (Set $set, Get $get, $state) {
$environment = $get($envPath = '../../environment'); $environment = $get($envPath = '../../environment');
@ -846,7 +846,7 @@ class CreateServer extends CreateRecord
return !$containsRuleIn; 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 private function getSelectOptionsFromRules(Get $get): array

View File

@ -66,14 +66,14 @@ class EditServer extends EditRecord
->prefixIcon('tabler-server') ->prefixIcon('tabler-server')
->label('Display Name') ->label('Display Name')
->suffixAction(Action::make('random') ->suffixAction(Action::make('random')
->icon('tabler-dice-'.random_int(1, 6)) ->icon('tabler-dice-' . random_int(1, 6))
->action(function (Set $set, Get $get) { ->action(function (Set $set, Get $get) {
$egg = Egg::find($get('egg_id')); $egg = Egg::find($get('egg_id'));
$prefix = $egg ? str($egg->name)->lower()->kebab().'-' : ''; $prefix = $egg ? str($egg->name)->lower()->kebab() . '-' : '';
$word = (new RandomWordService())->word(); $word = (new RandomWordService())->word();
$set('name', $prefix.$word); $set('name', $prefix . $word);
})) }))
->columnSpan([ ->columnSpan([
'default' => 2, 'default' => 2,
@ -541,7 +541,7 @@ class EditServer extends EditRecord
->hintIcon('tabler-code') ->hintIcon('tabler-code')
->label(fn (ServerVariable $serverVariable) => $serverVariable->variable->name) ->label(fn (ServerVariable $serverVariable) => $serverVariable->variable->name)
->hintIconTooltip(fn (ServerVariable $serverVariable) => implode('|', $serverVariable->variable->rules)) ->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); ->helperText(fn (ServerVariable $serverVariable) => empty($serverVariable->variable->description) ? '—' : $serverVariable->variable->description);
} }
@ -606,7 +606,7 @@ class EditServer extends EditRecord
->disabled() ->disabled()
->label('JDBC Connection String') ->label('JDBC Connection String')
->columnSpan(2) ->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') ->relationship('databases')
->deletable(false) ->deletable(false)
@ -800,7 +800,7 @@ class EditServer extends EditRecord
return $containsRuleIn; 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 private function getSelectOptionsFromRules(ServerVariable $serverVariable): array
@ -818,7 +818,7 @@ class EditServer extends EditRecord
protected function rotatePassword(DatabasePasswordService $service, $record, $set, $get): void protected function rotatePassword(DatabasePasswordService $service, $record, $set, $get): void
{ {
$newPassword = $service->handle($record); $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('password', $newPassword);
$set('JDBC', $jdbcString); $set('JDBC', $jdbcString);

View File

@ -178,7 +178,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
->content(fn () => new HtmlString(" ->content(fn () => new HtmlString("
<div style='width: 300px; background-color: rgb(24, 24, 27);'>$image</div> <div style='width: 300px; background-color: rgb(24, 24, 27);'>$image</div>
")) "))
->helperText('Setup Key: '.$secret), ->helperText('Setup Key: '. $secret),
TextInput::make('2facode') TextInput::make('2facode')
->label('Code') ->label('Code')
->requiredWith('2fapassword') ->requiredWith('2fapassword')

View File

@ -33,7 +33,7 @@ class ListUsers extends ListRecords
->visibleFrom('lg') ->visibleFrom('lg')
->label('') ->label('')
->extraImgAttributes(['class' => 'rounded-full']) ->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') TextColumn::make('external_id')
->searchable() ->searchable()
->hidden(), ->hidden(),
@ -55,7 +55,7 @@ class ListUsers extends ListRecords
->counts('roles') ->counts('roles')
->icon('tabler-users-group') ->icon('tabler-users-group')
->label('Roles') ->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') TextColumn::make('servers_count')
->counts('servers') ->counts('servers')
->icon('tabler-server') ->icon('tabler-server')

View File

@ -30,7 +30,7 @@ class EggShareController extends Controller
return response($this->exporterService->handle($egg->id), 200, [ return response($this->exporterService->handle($egg->id), 200, [
'Content-Transfer-Encoding' => 'binary', 'Content-Transfer-Encoding' => 'binary',
'Content-Description' => 'File Transfer', 'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename=egg-'.$filename.'.json', 'Content-Disposition' => 'attachment; filename=egg-' . $filename . '.json',
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
]); ]);
} }

View File

@ -56,7 +56,7 @@ class NodeAutoDeployController extends Controller
return new JsonResponse([ return new JsonResponse([
'node' => $node->id, 'node' => $node->id,
'token' => $key->identifier.$key->token, 'token' => $key->identifier . $key->token,
]); ]);
} }
} }

View File

@ -67,6 +67,6 @@ class CreateServerController extends Controller
$this->alert->success(trans('admin/server.alerts.server_created'))->flash(); $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);
} }
} }

View File

@ -115,7 +115,7 @@ class ServersController extends Controller
{ {
$this->suspensionService->toggle($server, $request->input('action')); $this->suspensionService->toggle($server, $request->input('action'));
$this->alert->success(trans('admin/server.alerts.suspension_toggled', [ $this->alert->success(trans('admin/server.alerts.suspension_toggled', [
'status' => $request->input('action').'ed', 'status' => $request->input('action') . 'ed',
]))->flash(); ]))->flash();
return redirect()->route('admin.servers.view.manage', $server->id); return redirect()->route('admin.servers.view.manage', $server->id);

View File

@ -83,7 +83,7 @@ class FileController extends ClientApiController
'file_path' => rawurldecode($request->get('file')), 'file_path' => rawurldecode($request->get('file')),
'server_uuid' => $server->uuid, '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(); Activity::event('server:file.download')->property('file', $request->get('file'))->log();

View File

@ -43,7 +43,7 @@ class FileUploadController extends ClientApiController
->setExpiresAt(CarbonImmutable::now()->addMinutes(15)) ->setExpiresAt(CarbonImmutable::now()->addMinutes(15))
->setUser($user) ->setUser($user)
->setClaims(['server_uuid' => $server->uuid]) ->setClaims(['server_uuid' => $server->uuid])
->handle($server->node, $user->id.$server->uuid); ->handle($server->node, $user->id . $server->uuid);
return sprintf( return sprintf(
'%s/upload/file?token=%s', '%s/upload/file?token=%s',

View File

@ -59,14 +59,14 @@ class WebsocketController extends ClientApiController
'server_uuid' => $server->uuid, 'server_uuid' => $server->uuid,
'permissions' => $permissions, 'permissions' => $permissions,
]) ])
->handle($node, $user->id.$server->uuid); ->handle($node, $user->id . $server->uuid);
$socket = str_replace(['https://', 'http://'], ['wss://', 'ws://'], $node->getConnectionAddress()); $socket = str_replace(['https://', 'http://'], ['wss://', 'ws://'], $node->getConnectionAddress());
return new JsonResponse([ return new JsonResponse([
'data' => [ 'data' => [
'token' => $token->toString(), 'token' => $token->toString(),
'socket' => $socket.sprintf('/api/servers/%s/ws', $server->uuid), 'socket' => $socket . sprintf('/api/servers/%s/ws', $server->uuid),
], ],
]); ]);
} }

View File

@ -64,7 +64,7 @@ class BackupStatusController extends Controller
// deleted easily. Also does not make sense to have a locked backup on the system // deleted easily. Also does not make sense to have a locked backup on the system
// that is failed. // that is failed.
'is_locked' => $successful ? $model->is_locked : false, '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, 'bytes' => $successful ? $request->input('size') : 0,
'completed_at' => CarbonImmutable::now(), 'completed_at' => CarbonImmutable::now(),
])->save(); ])->save();

View File

@ -160,6 +160,6 @@ class SftpAuthenticationController extends Controller
{ {
$username = explode('.', strrev($request->input('username', ''))); $username = explode('.', strrev($request->input('username', '')));
return strtolower(strrev($username[0] ?? '').'|'.$request->ip()); return strtolower(strrev($username[0] ?? '') . '|' . $request->ip());
} }
} }

View File

@ -48,7 +48,7 @@ class OAuthController extends Controller
} }
try { 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); $this->auth->guard()->login($user, true);
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -43,6 +43,6 @@ class AuthenticateIPAccess
->property('identifier', $token->identifier) ->property('identifier', $token->identifier)
->log(); ->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.');
} }
} }

View File

@ -80,7 +80,7 @@ class ResourceBelongsToServer
default: default:
// Don't return a 404 here since we want to make sure no one relies // 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. // 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));
} }
} }

View File

@ -18,7 +18,7 @@ class IsValidJson
try { try {
json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) { } 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());
} }
} }

View File

@ -38,7 +38,7 @@ class RequireTwoFactorAuthentication
public function handle(Request $request, \Closure $next): mixed public function handle(Request $request, \Closure $next): mixed
{ {
$user = $request->user(); $user = $request->user();
$uri = rtrim($request->getRequestUri(), '/').'/'; $uri = rtrim($request->getRequestUri(), '/') . '/';
$current = $request->route()->getName(); $current = $request->route()->getName();
if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) { if (!$user || Str::startsWith($uri, ['/auth/']) || Str::startsWith($current, ['auth.', 'account.'])) {

View File

@ -17,7 +17,7 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest
$modelRules = ApiKey::getRules(); $modelRules = ApiKey::getRules();
return collect(AdminAcl::getResourceList())->mapWithKeys(function ($resource) use ($modelRules) { 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(); })->merge(['memo' => $modelRules['memo']])->toArray();
} }

View File

@ -15,7 +15,7 @@ class EggVariableFormRequest extends AdminFormRequest
return [ return [
'name' => 'required|string|min:1|max:255', 'name' => 'required|string|min:1|max:255',
'description' => 'sometimes|nullable|string', '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', 'options' => 'sometimes|required|array',
'rules' => 'bail|required|string', 'rules' => 'bail|required|string',
'default_value' => 'present', 'default_value' => 'present',

View File

@ -39,7 +39,7 @@ class StoreApiKeyRequest extends ClientApiRequest
throw $exception; throw $exception;
} }
} finally { } 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.');
} }
} }
}); });

View File

@ -73,7 +73,7 @@ class RunTaskJob extends Job implements ShouldQueue
$deleteFilesService->handle($server, explode(PHP_EOL, $this->task->payload)); $deleteFilesService->handle($server, explode(PHP_EOL, $this->task->payload));
break; break;
default: default:
throw new \InvalidArgumentException('Invalid task action provided: '.$this->task->action); throw new \InvalidArgumentException('Invalid task action provided: ' . $this->task->action);
} }
} catch (\Exception $exception) { } catch (\Exception $exception) {
// If this isn't a DaemonConnectionException on a task that allows for failures // If this isn't a DaemonConnectionException on a task that allows for failures

View File

@ -110,14 +110,14 @@ class ApiKey extends Model
'memo', 'memo',
'last_used_at', 'last_used_at',
'expires_at', 'expires_at',
'r_'.AdminAcl::RESOURCE_USERS, 'r_' . AdminAcl::RESOURCE_USERS,
'r_'.AdminAcl::RESOURCE_ALLOCATIONS, 'r_' . AdminAcl::RESOURCE_ALLOCATIONS,
'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS, 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS,
'r_'.AdminAcl::RESOURCE_SERVER_DATABASES, 'r_' . AdminAcl::RESOURCE_SERVER_DATABASES,
'r_'.AdminAcl::RESOURCE_EGGS, 'r_' . AdminAcl::RESOURCE_EGGS,
'r_'.AdminAcl::RESOURCE_NODES, 'r_' . AdminAcl::RESOURCE_NODES,
'r_'.AdminAcl::RESOURCE_SERVERS, 'r_' . AdminAcl::RESOURCE_SERVERS,
'r_'.AdminAcl::RESOURCE_MOUNTS, 'r_' . AdminAcl::RESOURCE_MOUNTS,
]; ];
/** /**
@ -146,14 +146,14 @@ class ApiKey extends Model
'allowed_ips.*' => 'string', 'allowed_ips.*' => 'string',
'last_used_at' => 'nullable|date', 'last_used_at' => 'nullable|date',
'expires_at' => 'nullable|date', 'expires_at' => 'nullable|date',
'r_'.AdminAcl::RESOURCE_USERS => '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_ALLOCATIONS => 'integer|min:0|max:3',
'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS => '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_SERVER_DATABASES => 'integer|min:0|max:3',
'r_'.AdminAcl::RESOURCE_EGGS => '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_NODES => 'integer|min:0|max:3',
'r_'.AdminAcl::RESOURCE_SERVERS => '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_MOUNTS => 'integer|min:0|max:3',
]; ];
protected function casts(): array protected function casts(): array
@ -166,14 +166,14 @@ class ApiKey extends Model
'token' => 'encrypted', 'token' => 'encrypted',
self::CREATED_AT => 'datetime', self::CREATED_AT => 'datetime',
self::UPDATED_AT => 'datetime', self::UPDATED_AT => 'datetime',
'r_'.AdminAcl::RESOURCE_USERS => 'int', 'r_' . AdminAcl::RESOURCE_USERS => 'int',
'r_'.AdminAcl::RESOURCE_ALLOCATIONS => 'int', 'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int',
'r_'.AdminAcl::RESOURCE_DATABASE_HOSTS => 'int', 'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int',
'r_'.AdminAcl::RESOURCE_SERVER_DATABASES => 'int', 'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'int',
'r_'.AdminAcl::RESOURCE_EGGS => 'int', 'r_' . AdminAcl::RESOURCE_EGGS => 'int',
'r_'.AdminAcl::RESOURCE_NODES => 'int', 'r_' . AdminAcl::RESOURCE_NODES => 'int',
'r_'.AdminAcl::RESOURCE_SERVERS => 'int', 'r_' . AdminAcl::RESOURCE_SERVERS => 'int',
'r_'.AdminAcl::RESOURCE_MOUNTS => 'int', 'r_' . AdminAcl::RESOURCE_MOUNTS => 'int',
]; ];
} }
@ -227,6 +227,6 @@ class ApiKey extends Model
{ {
$prefix = self::getPrefixForType($type); $prefix = self::getPrefixForType($type);
return $prefix.Str::random(self::IDENTIFIER_LENGTH - strlen($prefix)); return $prefix . Str::random(self::IDENTIFIER_LENGTH - strlen($prefix));
} }
} }

View File

@ -54,7 +54,7 @@ class EggVariable extends Model
'sort' => 'nullable', 'sort' => 'nullable',
'name' => 'required|string|between:1,255', 'name' => 'required|string|between:1,255',
'description' => 'string', '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', 'default_value' => 'string',
'user_viewable' => 'boolean', 'user_viewable' => 'boolean',
'user_editable' => 'boolean', 'user_editable' => 'boolean',

View File

@ -48,7 +48,7 @@ class MultiFieldServerFilter implements Filter
}, },
// Otherwise, just try to search for that specific port in the allocations. // Otherwise, just try to search for that specific port in the allocations.
function (Builder $builder) use ($value) { function (Builder $builder) use ($value) {
$builder->orWhere('allocations.port', 'LIKE', substr($value, 1).'%'); $builder->orWhere('allocations.port', 'LIKE', substr($value, 1) . '%');
} }
); );
}) })

View File

@ -184,8 +184,8 @@ class Node extends Model
'port' => $this->daemon_listen, 'port' => $this->daemon_listen,
'ssl' => [ 'ssl' => [
'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'),
'cert' => '/etc/letsencrypt/live/'.Str::lower($this->fqdn).'/fullchain.pem', 'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem',
'key' => '/etc/letsencrypt/live/'.Str::lower($this->fqdn).'/privkey.pem', 'key' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/privkey.pem',
], ],
'upload_limit' => $this->upload_size, 'upload_limit' => $this->upload_size,
], ],

View File

@ -259,7 +259,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
*/ */
public function getNameAttribute(): string 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 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 public function canTarget(IlluminateModel $user): bool

View File

@ -33,13 +33,13 @@ class AccountCreated extends Notification implements ShouldQueue
public function toMail(): MailMessage public function toMail(): MailMessage
{ {
$message = (new MailMessage()) $message = (new MailMessage())
->greeting('Hello '.$this->user->name.'!') ->greeting('Hello ' . $this->user->name . '!')
->line('You are receiving this email because an account has been created for you on '.config('app.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('Username: ' . $this->user->username)
->line('Email: '.$this->user->email); ->line('Email: ' . $this->user->email);
if (!is_null($this->token)) { 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; return $message;

View File

@ -35,9 +35,9 @@ class AddedToServer extends Notification implements ShouldQueue
public function toMail(): MailMessage public function toMail(): MailMessage
{ {
return (new 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('You have been added as a subuser for the following server, allowing you certain control over the server.')
->line('Server Name: '.$this->server->name) ->line('Server Name: ' . $this->server->name)
->action('Visit Server', url('/server/'.$this->server->uuid_short)); ->action('Visit Server', url('/server/' . $this->server->uuid_short));
} }
} }

View File

@ -21,7 +21,7 @@ class MailTested extends Notification
{ {
return (new MailMessage()) return (new MailMessage())
->subject('Panel Test Message') ->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!'); ->line('This is a test of the Panel mail system. You\'re good to go!');
} }
} }

View File

@ -36,9 +36,9 @@ class RemovedFromServer extends Notification implements ShouldQueue
{ {
return (new MailMessage()) return (new MailMessage())
->error() ->error()
->greeting('Hello '.$this->server->user.'.') ->greeting('Hello ' . $this->server->user . '.')
->line('You have been removed as a subuser for the following server.') ->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')); ->action('Visit Panel', route('index'));
} }
} }

View File

@ -34,7 +34,7 @@ class SendPasswordReset extends Notification implements ShouldQueue
return (new MailMessage()) return (new MailMessage())
->subject('Reset Password') ->subject('Reset Password')
->line('You are receiving this email because we received a password reset request for your account.') ->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.'); ->line('If you did not request a password reset, no further action is required.');
} }
} }

View File

@ -51,9 +51,9 @@ class ServerInstalled extends Notification implements ShouldQueue
public function toMail(): MailMessage public function toMail(): MailMessage
{ {
return (new 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('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')); ->action('Login and Begin Using', route('index'));
} }
} }

View File

@ -12,7 +12,7 @@ trait DefaultPolicies
*/ */
public function viewAny(User $user): bool 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 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 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 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 public function delete(User $user, Model $model): bool
{ {
return $user->can('delete '.$this->modelName, $model); return $user->can('delete ' . $this->modelName, $model);
} }
} }

View File

@ -19,7 +19,7 @@ class DaemonConfigurationRepository extends DaemonRepository
$response = $this $response = $this
->getHttpClient() ->getHttpClient()
->connectTimeout($connectTimeout) ->connectTimeout($connectTimeout)
->get('/api/system'.(!is_null($version) ? '?v='.$version : '')); ->get('/api/system' . (!is_null($version) ? '?v=' . $version : ''));
} catch (TransferException $exception) { } catch (TransferException $exception) {
throw new DaemonConnectionException($exception); throw new DaemonConnectionException($exception);
} }

View File

@ -96,7 +96,7 @@ class DaemonServerRepository extends DaemonRepository
Assert::isInstanceOf($this->server, Server::class); Assert::isInstanceOf($this->server, Server::class);
try { try {
$this->getHttpClient()->delete('/api/servers/'.$this->server->uuid); $this->getHttpClient()->delete('/api/servers/' . $this->server->uuid);
} catch (TransferException $exception) { } catch (TransferException $exception) {
throw new DaemonConnectionException($exception); throw new DaemonConnectionException($exception);
} }
@ -192,7 +192,7 @@ class DaemonServerRepository extends DaemonRepository
{ {
Assert::isInstanceOf($this->server, Server::class); Assert::isInstanceOf($this->server, Server::class);
$this->revokeJTIs([md5($id.$this->server->uuid)]); $this->revokeJTIs([md5($id . $this->server->uuid)]);
} }
/** /**

View File

@ -62,7 +62,7 @@ class AdminAcl
*/ */
public static function check(ApiKey $key, string $resource, int $action = self::READ): bool 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);
} }
/** /**

View File

@ -34,7 +34,7 @@ class DownloadLinkService
'backup_uuid' => $backup->uuid, 'backup_uuid' => $backup->uuid,
'server_uuid' => $backup->server->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()); return sprintf('%s/download/backup?token=%s', $backup->server->node->getConnectionAddress(), $token->toString());
} }

View File

@ -30,7 +30,7 @@ class DeleteFilesService
$pattern = basename($line); $pattern = basename($line);
collect($this->daemonFileRepository->setServer($server)->getDirectory($path))->each(function ($item) use ($path, $pattern, $filesToDelete) { collect($this->daemonFileRepository->setServer($server)->getDirectory($path))->each(function ($item) use ($path, $pattern, $filesToDelete) {
if (Str::is($pattern, $item['name'])) { if (Str::is($pattern, $item['name'])) {
$filesToDelete->push($path.'/'.$item['name']); $filesToDelete->push($path . '/' . $item['name']);
} }
}); });
} }

View File

@ -70,7 +70,7 @@ class AssetHashService
$output .= " $key=\"$value\""; $output .= " $key=\"$value\"";
} }
return $output.'>'; return $output . '>';
} }
/** /**
@ -92,7 +92,7 @@ class AssetHashService
$output .= " $key=\"$value\""; $output .= " $key=\"$value\"";
} }
return $output.'></script>'; return $output . '></script>';
} }
/** /**

View File

@ -127,13 +127,13 @@ class SoftwareVersionService
$head = explode(' ', file_get_contents(base_path('.git/HEAD'))); $head = explode(' ', file_get_contents(base_path('.git/HEAD')));
if (array_key_exists(1, $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)) { if (isset($path) && file_exists($path)) {
return [ return [
'version' => 'canary ('.substr(file_get_contents($path), 0, 8).')', 'version' => 'canary (' . substr(file_get_contents($path), 0, 8) . ')',
'is_git' => true, 'is_git' => true,
]; ];
} }

View File

@ -15,7 +15,7 @@ class StartupCommandService
$replace = [$server->memory, $server->allocation->ip, $server->allocation->port]; $replace = [$server->memory, $server->allocation->ip, $server->allocation->port];
foreach ($server->variables as $variable) { 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]'; $replace[] = ($variable->user_viewable && !$hideAllValues) ? ($variable->server_value ?? $variable->default_value) : '[hidden]';
} }

View File

@ -31,8 +31,8 @@ class TransferServerService
Http::daemon($server->node)->post('/api/transfer', [ Http::daemon($server->node)->post('/api/transfer', [
'json' => [ 'json' => [
'server_id' => $server->uuid, 'server_id' => $server->uuid,
'url' => $server->node->getConnectionAddress()."/api/servers/$server->uuid/archive", 'url' => $server->node->getConnectionAddress() . "/api/servers/$server->uuid/archive",
'token' => 'Bearer '.$token->toString(), 'token' => 'Bearer ' . $token->toString(),
'server' => [ 'server' => [
'uuid' => $server->uuid, 'uuid' => $server->uuid,
'start_on_completion' => false, 'start_on_completion' => false,

View File

@ -40,8 +40,8 @@ class VariableValidatorService
$data = $rules = $customAttributes = []; $data = $rules = $customAttributes = [];
foreach ($variables as $variable) { foreach ($variables as $variable) {
$data['environment'][$variable->env_variable] = array_get($fields, $variable->env_variable); $data['environment'][$variable->env_variable] = array_get($fields, $variable->env_variable);
$rules['environment.'.$variable->env_variable] = $variable->rules; $rules['environment.' . $variable->env_variable] = $variable->rules;
$customAttributes['environment.'.$variable->env_variable] = trans('validation.internal.variable_value', ['env' => $variable->name]); $customAttributes['environment.' . $variable->env_variable] = trans('validation.internal.variable_value', ['env' => $variable->name]);
} }
$validator = $this->validator->make($data, $rules, [], $customAttributes); $validator = $this->validator->make($data, $rules, [], $customAttributes);

View File

@ -39,7 +39,7 @@ class SubuserCreationService
if (!$user) { if (!$user) {
// Just cap the username generated at 64 characters at most and then append a random string // Just cap the username generated at 64 characters at most and then append a random string
// to the end to make it "unique"... // 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([ $user = $this->userCreationService->handle([
'email' => $email, 'email' => $email,

View File

@ -37,10 +37,10 @@ trait EnvironmentWriterTrait
$key = strtoupper($key); $key = strtoupper($key);
$saveValue = sprintf('%s=%s', $key, $this->escapeEnvironmentValue($value ?? '')); $saveValue = sprintf('%s=%s', $key, $this->escapeEnvironmentValue($value ?? ''));
if (preg_match_all('/^'.$key.'=(.*)$/m', $saveContents) < 1) { if (preg_match_all('/^' . $key . '=(.*)$/m', $saveContents) < 1) {
$saveContents = $saveContents.PHP_EOL.$saveValue; $saveContents = $saveContents . PHP_EOL . $saveValue;
} else { } else {
$saveContents = preg_replace('/^'.$key.'=(.*)$/m', $saveValue, $saveContents); $saveContents = preg_replace('/^' . $key . '=(.*)$/m', $saveValue, $saveContents);
} }
}); });

View File

@ -62,7 +62,7 @@ class ActivityLogTransformer extends BaseClientTransformer
if (!is_array($value)) { if (!is_array($value)) {
// Perform some directory normalization at this point. // Perform some directory normalization at this point.
if ($key === 'directory') { if ($key === 'directory') {
$value = str_replace('//', '/', '/'.trim($value, '/').'/'); $value = str_replace('//', '/', '/' . trim($value, '/') . '/');
} }
return [$key => $value]; return [$key => $value];
@ -94,7 +94,7 @@ class ActivityLogTransformer extends BaseClientTransformer
return false; return false;
} }
$str = trans('activity.'.str_replace(':', '.', $model->event)); $str = trans('activity.' . str_replace(':', '.', $model->event));
preg_match_all('/:(?<key>[\w.-]+\w)(?:[^\w:]?|$)/', $str, $matches); preg_match_all('/:(?<key>[\w.-]+\w)(?:[^\w:]?|$)/', $str, $matches);
$exclude = array_merge($matches['key'], ['ip', 'useragent', 'using_sftp']); $exclude = array_merge($matches['key'], ['ip', 'useragent', 'using_sftp']);

View File

@ -28,7 +28,7 @@ class UserTransformer extends BaseClientTransformer
'first_name' => $user->name_first, 'first_name' => $user->name_first,
'last_name' => $user->name_last, 'last_name' => $user->name_last,
'language' => $user->language, '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" 'admin' => $user->isRootAdmin(), // deprecated, use "root_admin"
'root_admin' => $user->isRootAdmin(), 'root_admin' => $user->isRootAdmin(),
'2fa_enabled' => (bool) $user->use_totp, '2fa_enabled' => (bool) $user->use_totp,

View File

@ -5,9 +5,9 @@ use NunoMaduro\Collision\Provider;
use Illuminate\Contracts\Console\Kernel; use Illuminate\Contracts\Console\Kernel;
use Symfony\Component\Console\Output\ConsoleOutput; 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 */ /** @var \App\Console\Kernel $kernel */
$kernel = $app->make(Kernel::class); $kernel = $app->make(Kernel::class);
@ -23,10 +23,10 @@ $kernel->bootstrap();
$output = new ConsoleOutput(); $output = new ConsoleOutput();
$prefix = 'database.connections.'.config('database.default'); $prefix = 'database.connections.' . config('database.default');
if (!Str::contains(config("$prefix.database"), 'test')) { if (!Str::contains(config("$prefix.database"), 'test')) {
$output->writeln(PHP_EOL.'<error>Cannot run test process against non-testing database.</error>'); $output->writeln(PHP_EOL . '<error>Cannot run test process against non-testing database.</error>');
$output->writeln(PHP_EOL.'<error>Environment is currently pointed at: "'.config("$prefix.database").'".</error>'); $output->writeln(PHP_EOL . '<error>Environment is currently pointed at: "' . config("$prefix.database") . '".</error>');
exit(1); exit(1);
} }
@ -35,11 +35,11 @@ if (!Str::contains(config("$prefix.database"), 'test')) {
* running the tests. * running the tests.
*/ */
if (!env('SKIP_MIGRATIONS')) { if (!env('SKIP_MIGRATIONS')) {
$output->writeln(PHP_EOL.'<info>Refreshing database for Integration tests...</info>'); $output->writeln(PHP_EOL . '<info>Refreshing database for Integration tests...</info>');
$kernel->call('migrate:fresh'); $kernel->call('migrate:fresh');
$output->writeln('<info>Seeding database for Integration tests...</info>'.PHP_EOL); $output->writeln('<info>Seeding database for Integration tests...</info>' . PHP_EOL);
$kernel->call('db:seed'); $kernel->call('db:seed');
} else { } else {
$output->writeln(PHP_EOL.'<comment>Skipping database migrations...</comment>'.PHP_EOL); $output->writeln(PHP_EOL . '<comment>Skipping database migrations...</comment>' . PHP_EOL);
} }

View File

@ -24,7 +24,7 @@ class NodeFactory extends Factory
return [ return [
'uuid' => Uuid::uuid4()->toString(), 'uuid' => Uuid::uuid4()->toString(),
'public' => true, 'public' => true,
'name' => 'FactoryNode_'.Str::random(10), 'name' => 'FactoryNode_' . Str::random(10),
'fqdn' => $this->faker->unique()->ipv4(), 'fqdn' => $this->faker->unique()->ipv4(),
'scheme' => 'http', 'scheme' => 'http',
'behind_proxy' => false, 'behind_proxy' => false,

View File

@ -27,8 +27,8 @@ class UserFactory extends Factory
return [ return [
'external_id' => null, 'external_id' => null,
'uuid' => Uuid::uuid4()->toString(), 'uuid' => Uuid::uuid4()->toString(),
'username' => $this->faker->userName().'_'.Str::random(10), 'username' => $this->faker->userName() . '_' . Str::random(10),
'email' => Str::random(32).'@example.com', 'email' => Str::random(32) . '@example.com',
'name_first' => $this->faker->firstName(), 'name_first' => $this->faker->firstName(),
'name_last' => $this->faker->lastName(), 'name_last' => $this->faker->lastName(),
'password' => $password ?: $password = bcrypt('password'), 'password' => $password ?: $password = bcrypt('password'),

View File

@ -47,9 +47,9 @@ class EggSeeder extends Seeder
*/ */
protected function parseEggFiles($name) 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 */ /** @var \DirectoryIterator $file */
foreach ($files as $file) { foreach ($files as $file) {
if (!$file->isFile() || !$file->isReadable()) { if (!$file->isFile() || !$file->isReadable()) {
@ -71,10 +71,10 @@ class EggSeeder extends Seeder
if ($egg instanceof Egg) { if ($egg instanceof Egg) {
$this->importerService->fromFile($file, $egg); $this->importerService->fromFile($file, $egg);
$this->command->info('Updated '.$decoded['name']); $this->command->info('Updated ' . $decoded['name']);
} else { } else {
$this->importerService->fromFile($file); $this->importerService->fromFile($file);
$this->command->comment('Created '.$decoded['name']); $this->command->comment('Created ' . $decoded['name']);
} }
} }

View File

@ -17,7 +17,7 @@ return new class extends Migration
DB::transaction(function () { DB::transaction(function () {
foreach (DB::table('service_variables')->get() as $variable) { 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(); $variable->save();
} }
}); });

View File

@ -17,7 +17,7 @@ return new class extends Migration
continue; 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]); DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]);
} }
@ -35,7 +35,7 @@ return new class extends Migration
continue; 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]); DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]);
} }

View File

@ -21,7 +21,7 @@ return new class extends Migration
$inserts[] = [ $inserts[] = [
'user_id' => $server->owner_id, 'user_id' => $server->owner_id,
'server_id' => $server->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(), 'expires_at' => Carbon::now()->addMinutes(config('panel.api.key_expire_time', 720))->toDateTimeString(),
'created_at' => Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),

View File

@ -19,7 +19,7 @@ return new class extends Migration
$inserts[] = [ $inserts[] = [
'user_id' => $subuser->user_id, 'user_id' => $subuser->user_id,
'server_id' => $subuser->server_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(), 'expires_at' => Carbon::now()->addMinutes(config('panel.api.key_expire_time', 720))->toDateTimeString(),
'created_at' => Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => Carbon::now()->toDateTimeString(), 'updated_at' => Carbon::now()->toDateTimeString(),

View File

@ -112,9 +112,9 @@ return new class extends Migration
} }
if (!empty($values)) { 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);
} }
} }

View File

@ -53,7 +53,7 @@ return new class extends Migration
DB::transaction(function () { DB::transaction(function () {
foreach (DB::select('SELECT id, daemon_token_id, daemon_token FROM nodes') as $datum) { foreach (DB::select('SELECT id, daemon_token_id, daemon_token FROM nodes') as $datum) {
DB::update('UPDATE nodes SET daemon_token = ? WHERE id = ?', [ 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, $datum->id,
]); ]);
} }

View File

@ -1,6 +1,7 @@
{ {
"preset": "laravel", "preset": "laravel",
"rules": { "rules": {
"concat_space": false,
"not_operator_with_successor_space": false, "not_operator_with_successor_space": false,
"ordered_imports": false "ordered_imports": false
} }

View File

@ -35,7 +35,7 @@ trait AssertsActivityLogged
public function assertActivitySubjects(string $event, Model|array $subjects): void public function assertActivitySubjects(string $event, Model|array $subjects): void
{ {
if (is_array($subjects)) { 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 { } else {
$subjects = array_slice(func_get_args(), 1); $subjects = array_slice(func_get_args(), 1);
} }

View File

@ -11,7 +11,7 @@ trait MiddlewareAttributeAssertionsTrait
*/ */
public function assertRequestHasAttribute(string $attribute): void 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 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.');
} }
/** /**

View File

@ -38,7 +38,7 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
$this $this
->withHeader('Accept', 'application/vnd.panel.v1+json') ->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 public function getApiUser(): User
@ -58,7 +58,7 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
{ {
$this->key = $this->createApiKey($user, $permissions); $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; return $this->key;
} }

View File

@ -48,7 +48,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
$this->assertSame( $this->assertSame(
$expected, $expected,
$actual, $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); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',
@ -82,7 +82,7 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
{ {
$egg = Egg::query()->findOrFail(1); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonStructure([ $response->assertJsonStructure([
'object', 'object',

View File

@ -16,7 +16,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
{ {
$user = User::factory()->create(['external_id' => Str::random()]); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonCount(2); $response->assertJsonCount(2);
$response->assertJsonStructure([ $response->assertJsonStructure([
@ -64,7 +64,7 @@ class ExternalUserControllerTest extends ApplicationApiIntegrationTestCase
$user = User::factory()->create(['external_id' => Str::random()]); $user = User::factory()->create(['external_id' => Str::random()]);
$this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); $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); $this->assertAccessDeniedJson($response);
} }
} }

View File

@ -89,7 +89,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
{ {
$user = User::factory()->create(); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonCount(2); $response->assertJsonCount(2);
$response->assertJsonStructure([ $response->assertJsonStructure([
@ -124,7 +124,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$user = User::factory()->create(); $user = User::factory()->create();
$server = $this->createServerModel(['user_id' => $user->id]); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonCount(2); $response->assertJsonCount(2);
$response->assertJsonStructure([ $response->assertJsonStructure([
@ -157,7 +157,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$user = User::factory()->create(); $user = User::factory()->create();
$this->createServerModel(['user_id' => $user->id]); $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->assertStatus(Response::HTTP_OK);
$response->assertJsonCount(2)->assertJsonCount(1, 'attributes.relationships'); $response->assertJsonCount(2)->assertJsonCount(1, 'attributes.relationships');
$response->assertJsonStructure([ $response->assertJsonStructure([
@ -199,7 +199,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$user = User::factory()->create(); $user = User::factory()->create();
$this->createNewDefaultApiKey($this->getApiUser(), ['r_users' => 0]); $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); $this->assertAccessDeniedJson($response);
} }
@ -242,7 +242,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
{ {
$user = User::factory()->create(); $user = User::factory()->create();
$response = $this->patchJson('/api/application/users/'.$user->id, [ $response = $this->patchJson('/api/application/users/' . $user->id, [
'username' => 'new.test.name', 'username' => 'new.test.name',
'email' => 'new@emailtest.com', 'email' => 'new@emailtest.com',
'first_name' => $user->name_first, 'first_name' => $user->name_first,
@ -272,7 +272,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
$user = User::factory()->create(); $user = User::factory()->create();
$this->assertDatabaseHas('users', ['id' => $user->id]); $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); $response->assertStatus(Response::HTTP_NO_CONTENT);
$this->assertDatabaseMissing('users', ['id' => $user->id]); $this->assertDatabaseMissing('users', ['id' => $user->id]);

View File

@ -28,7 +28,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
'first_name' => $user->name_first, 'first_name' => $user->name_first,
'last_name' => $user->name_last, 'last_name' => $user->name_last,
'language' => 'en', 'language' => 'en',
'image' => 'https://gravatar.com/avatar/'.md5(Str::lower($user->email)), 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)),
'admin' => false, 'admin' => false,
'root_admin' => false, 'root_admin' => false,
'2fa_enabled' => false, '2fa_enabled' => false,
@ -47,7 +47,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
$user = User::factory()->create(); $user = User::factory()->create();
$response = $this->actingAs($user)->putJson('/api/client/account/email', [ $response = $this->actingAs($user)->putJson('/api/client/account/email', [
'email' => $email = Str::random().'@example.com', 'email' => $email = Str::random() . '@example.com',
'password' => 'password', 'password' => 'password',
]); ]);

View File

@ -83,7 +83,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
{ {
$ips = []; $ips = [];
for ($i = 0; $i < 100; $i++) { for ($i = 0; $i < 100; $i++) {
$ips[] = '127.0.0.'.$i; $ips[] = '127.0.0.' . $i;
} }
$this->actingAs(User::factory()->create()) $this->actingAs(User::factory()->create())
@ -162,7 +162,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
'key_type' => ApiKey::TYPE_ACCOUNT, '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); $response->assertStatus(Response::HTTP_NO_CONTENT);
$this->assertDatabaseMissing('api_keys', ['id' => $key->id]); $this->assertDatabaseMissing('api_keys', ['id' => $key->id]);
@ -205,7 +205,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
]); ]);
$this->actingAs($user) $this->actingAs($user)
->deleteJson('/api/client/account/api-keys/'.$key->identifier) ->deleteJson('/api/client/account/api-keys/' . $key->identifier)
->assertNotFound(); ->assertNotFound();
$this->assertDatabaseHas('api_keys', ['id' => $key->id]); $this->assertDatabaseHas('api_keys', ['id' => $key->id]);
@ -226,7 +226,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
]); ]);
$this->actingAs($user) $this->actingAs($user)
->deleteJson('/api/client/account/api-keys/'.$key->identifier) ->deleteJson('/api/client/account/api-keys/' . $key->identifier)
->assertNotFound(); ->assertNotFound();
$this->assertDatabaseHas('api_keys', ['id' => $key->id]); $this->assertDatabaseHas('api_keys', ['id' => $key->id]);

View File

@ -69,7 +69,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
throw new \InvalidArgumentException(sprintf('Cannot create link for Model of type %s', class_basename($model))); 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, '/') : '');
} }
/** /**

View File

@ -298,7 +298,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
$this->createServerModel(['user_id' => $users[1]->id]); $this->createServerModel(['user_id' => $users[1]->id]);
$this->createServerModel(['user_id' => $users[2]->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->assertOk();
$response->assertJsonCount(0, 'data'); $response->assertJsonCount(0, 'data');

View File

@ -30,20 +30,20 @@ class AllocationAuthorizationTest extends ClientApiIntegrationTestCase
// This is the only valid call for this test, accessing the allocation for the same // This is the only valid call for this test, accessing the allocation for the same
// server that the API user is the owner of. // 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->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422);
// This request fails because the allocation is valid for that server but the user // This request fails because the allocation is valid for that server but the user
// making the request is not authorized to perform that action. // 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 // 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 // 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. // 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/' . $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($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($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($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound();
} }
public static function methodDataProvider(): array public static function methodDataProvider(): array

View File

@ -38,20 +38,20 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase
// This is the only valid call for this test, accessing the backup for the same // This is the only valid call for this test, accessing the backup for the same
// server that the API user is the owner of. // 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); ->assertStatus($method === 'DELETE' ? 204 : 200);
// This request fails because the backup is valid for that server but the user // This request fails because the backup is valid for that server but the user
// making the request is not authorized to perform that action. // 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 // 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 // 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. // 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/' . $backup2->uuid . $endpoint))->assertNotFound();
$this->actingAs($user)->json($method, $this->link($server1, '/backups/'.$backup3->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($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($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound();
} }
public static function methodDataProvider(): array public static function methodDataProvider(): array

View File

@ -40,20 +40,20 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase
// This is the only valid call for this test, accessing the database for the same // This is the only valid call for this test, accessing the database for the same
// server that the API user is the owner of. // 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); ->assertStatus($method === 'DELETE' ? 204 : 200);
// This request fails because the database is valid for that server but the user // This request fails because the database is valid for that server but the user
// making the request is not authorized to perform that action. // 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 // 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 // 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. // 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/' . $database2->id . $endpoint))->assertNotFound();
$this->actingAs($user)->json($method, $this->link($server1, '/databases/'.$database3->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($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($server3, '/databases/' . $database3->id . $endpoint))->assertNotFound();
} }
public static function methodDataProvider(): array public static function methodDataProvider(): array

View File

@ -47,13 +47,13 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
$response->assertJsonCount(1, 'data'); $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 . 'object', Schedule::RESOURCE_NAME);
$response->assertJsonPath($prefix.'attributes.relationships.tasks.data.0.object', Task::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'), $schedule);
$this->assertJsonTransformedWith($response->json($prefix.'attributes.relationships.tasks.data.0.attributes'), $task); $this->assertJsonTransformedWith($response->json($prefix . 'attributes.relationships.tasks.data.0.attributes'), $task);
} }
/** /**

View File

@ -38,20 +38,20 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase
// This is the only valid call for this test, accessing the schedule for the same // This is the only valid call for this test, accessing the schedule for the same
// server that the API user is the owner of. // 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->assertTrue($response->status() <= 204 || $response->status() === 400 || $response->status() === 422);
// This request fails because the schedule is valid for that server but the user // This request fails because the schedule is valid for that server but the user
// making the request is not authorized to perform that action. // 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 // 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 // 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. // 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/' . $schedule2->id . $endpoint))->assertNotFound();
$this->actingAs($user)->json($method, $this->link($server1, '/schedules/'.$schedule3->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($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($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound();
} }
public static function methodDataProvider(): array public static function methodDataProvider(): array

View File

@ -33,7 +33,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
])->save(); ])->save();
$server = $server->refresh(); $server = $server->refresh();
$response = $this->actingAs($user)->getJson($this->link($server).'/startup'); $response = $this->actingAs($user)->getJson($this->link($server) . '/startup');
$response->assertOk(); $response->assertOk();
$response->assertJsonPath('meta.startup_command', 'java bungeecord.jar --version [hidden]'); $response->assertJsonPath('meta.startup_command', 'java bungeecord.jar --version [hidden]');
@ -52,10 +52,10 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
public function testStartupDataIsNotReturnedWithoutPermission(): void public function testStartupDataIsNotReturnedWithoutPermission(): void
{ {
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); [$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(); $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 public static function permissionsDataProvider(): array

View File

@ -23,7 +23,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
'startup' => 'java {{SERVER_JARFILE}} --version {{BUNGEE_VERSION}}', 'startup' => 'java {{SERVER_JARFILE}} --version {{BUNGEE_VERSION}}',
])->save(); ])->save();
$response = $this->actingAs($user)->putJson($this->link($server).'/startup/variable', [ $response = $this->actingAs($user)->putJson($this->link($server) . '/startup/variable', [
'key' => 'BUNGEE_VERSION', 'key' => 'BUNGEE_VERSION',
'value' => '1.2.3', 'value' => '1.2.3',
]); ]);
@ -32,7 +32,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$response->assertJsonPath('errors.0.code', 'ValidationException'); $response->assertJsonPath('errors.0.code', 'ValidationException');
$response->assertJsonPath('errors.0.detail', 'The value may only contain letters and numbers.'); $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', 'key' => 'BUNGEE_VERSION',
'value' => '123', 'value' => '123',
]); ]);
@ -62,7 +62,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$server->fill(['egg_id' => $egg->id])->save(); $server->fill(['egg_id' => $egg->id])->save();
$server->refresh(); $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', 'key' => 'BUNGEE_VERSION',
'value' => '123', 'value' => '123',
]); ]);
@ -71,7 +71,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$response->assertJsonPath('errors.0.code', 'BadRequestHttpException'); $response->assertJsonPath('errors.0.code', 'BadRequestHttpException');
$response->assertJsonPath('errors.0.detail', 'The environment variable you are trying to edit does not exist.'); $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', 'key' => 'SERVER_JARFILE',
'value' => 'server2.jar', 'value' => 'server2.jar',
]); ]);
@ -100,7 +100,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$server->refresh(); $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', 'key' => 'SERVER_JARFILE',
'value' => 'server2.jar', 'value' => 'server2.jar',
]); ]);
@ -125,7 +125,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$server->fill(['egg_id' => $egg->id])->save(); $server->fill(['egg_id' => $egg->id])->save();
$server->refresh(); $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', 'key' => 'BUNGEE_VERSION',
'value' => '', 'value' => '',
]); ]);
@ -141,10 +141,10 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
public function testStartupVariableCannotBeUpdatedIfNotUserViewable(): void public function testStartupVariableCannotBeUpdatedIfNotUserViewable(): void
{ {
[$user, $server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]); [$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(); $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 public static function permissionsDataProvider(): array

View File

@ -23,7 +23,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
{ {
[$user, $server] = $this->generateTestAccount($permissions); [$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(), 'email' => $email = $this->faker->email(),
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
@ -60,7 +60,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
Permission::ACTION_CONTROL_CONSOLE, 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(), 'email' => $this->faker->email(),
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
@ -80,9 +80,9 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
{ {
[$user, $server] = $this->generateTestAccount(); [$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, 'email' => $email,
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
@ -91,8 +91,8 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
$response->assertOk(); $response->assertOk();
$response = $this->actingAs($user)->postJson($this->link($server).'/users', [ $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
'email' => $email.'.au', 'email' => $email . '.au',
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
], ],
@ -114,7 +114,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
/** @var \App\Models\User $existing */ /** @var \App\Models\User $existing */
$existing = User::factory()->create(['email' => $this->faker->email()]); $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, 'email' => $existing->email,
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
@ -134,7 +134,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
{ {
[$user, $server] = $this->generateTestAccount(); [$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(), 'email' => $email = $this->faker->email(),
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,
@ -143,7 +143,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
$response->assertOk(); $response->assertOk();
$response = $this->actingAs($user)->postJson($this->link($server).'/users', [ $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
'email' => $email, 'email' => $email,
'permissions' => [ 'permissions' => [
Permission::ACTION_USER_CREATE, Permission::ACTION_USER_CREATE,

View File

@ -31,7 +31,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
$real = Uuid::uuid4()->toString(); $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. // 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 */ /** @var \App\Models\User $subuser */
$subuser = User::factory()->create(['uuid' => $uuid]); $subuser = User::factory()->create(['uuid' => $uuid]);
@ -44,11 +44,11 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
$mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); $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 // 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. // anything in the database.
$uuid = '18180000'.substr(Uuid::uuid4()->toString(), 8); $uuid = '18180000' . substr(Uuid::uuid4()->toString(), 8);
/** @var \App\Models\User $subuser */ /** @var \App\Models\User $subuser */
$subuser = User::factory()->create(['uuid' => $uuid]); $subuser = User::factory()->create(['uuid' => $uuid]);
@ -60,6 +60,6 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
$mock->expects('setServer->revokeUserJTI')->with($subuser->id)->andReturnUndefined(); $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();
} }
} }

View File

@ -41,12 +41,12 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
} }
// This route is acceptable since they're accessing a subuser on their own server. // 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 // 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. // 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($server2, '/users/' . $internal->uuid))->assertForbidden();
$this->actingAs($user)->json($method, $this->link($server3, '/users/'.$internal->uuid))->assertNotFound(); $this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound();
} }
public static function methodDataProvider(): array public static function methodDataProvider(): array

View File

@ -69,7 +69,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
$this->expectException(AccessDeniedHttpException::class); $this->expectException(AccessDeniedHttpException::class);
$this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); $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()); $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
} }
@ -98,7 +98,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
$node->save(); $node->save();
$this->request->expects('route->getName')->withNoArgs()->andReturn('random.route'); $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->getMiddleware()->handle($this->request, $this->getClosureAssertions());
$this->assertRequestHasAttribute('node'); $this->assertRequestHasAttribute('node');

Some files were not shown because too many files have changed in this diff Show More