Skip to content

Commit 272ccfd

Browse files
committed
chore: lint/pint
1 parent fe346eb commit 272ccfd

File tree

170 files changed

+1473
-1537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+1473
-1537
lines changed

app/Console/Commands/AttachWebhook.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,41 @@ public function handle()
3434

3535
// Get all stores for selection
3636
$stores = PolydockStore::all();
37-
37+
3838
if ($stores->isEmpty()) {
3939
$this->error('No stores found. Please create a store first.');
40+
4041
return 1;
4142
}
4243

4344
// Select store
4445
$storeId = $this->option('store-id');
45-
if (!$storeId) {
46+
if (! $storeId) {
4647
$storeOptions = $stores->mapWithKeys(function ($store) {
4748
return [$store->id => "{$store->name} (ID: {$store->id})"];
4849
})->toArray();
49-
50+
5051
$selectedStoreValue = $this->choice('Select a store to attach webhook to:', $storeOptions);
5152
$storeId = collect($storeOptions)->search($selectedStoreValue);
52-
if(empty($storeId)) {
53-
$this->error("Unable to find store ID");
53+
if (empty($storeId)) {
54+
$this->error('Unable to find store ID');
5455
exit(1);
5556
}
5657
}
5758

5859
// Validate store exists
5960
$store = PolydockStore::find($storeId);
60-
if (!$store) {
61+
if (! $store) {
6162
$this->error("Store with ID {$storeId} not found.");
63+
6264
return 1;
6365
}
6466

6567
// Get webhook URL
6668
$webhookUrl = $this->option('url') ?? $this->ask('Webhook URL');
6769
if (empty($webhookUrl)) {
6870
$this->error('Webhook URL is required. Exiting...');
71+
6972
return 1;
7073
}
7174

@@ -82,8 +85,8 @@ public function handle()
8285

8386
$this->info("✅ Webhook attached successfully to store '{$store->name}' with ID: {$webhook->id}");
8487
$this->line(" URL: {$webhook->url}");
85-
$this->line(" Active: " . ($webhook->active ? 'Yes' : 'No'));
86-
88+
$this->line(' Active: '.($webhook->active ? 'Yes' : 'No'));
89+
8790
return 0;
8891
}
8992
}

app/Console/Commands/CreateStore.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,53 +37,55 @@ class CreateStore extends Command
3737
public function handle()
3838
{
3939
$this->info('Creating a new Polydock Store...');
40-
40+
4141
// Gather store information
4242
$name = $this->option('name') ?? $this->ask('Store name');
43-
43+
4444
$status = $this->option('status') ?? $this->choice(
45-
'Store status',
45+
'Store status',
4646
['public', 'private']
4747
);
48-
48+
4949
$listedInput = $this->option('listed') ?? $this->choice(
50-
'Listed in marketplace?',
50+
'Listed in marketplace?',
5151
['true', 'false']
5252
);
5353
$listed = filter_var($listedInput, FILTER_VALIDATE_BOOLEAN);
54-
54+
5555
$regionId = $this->option('region-id') ?? $this->ask('Lagoon deploy region ID');
56-
56+
5757
$prefix = $this->option('prefix') ?? $this->ask('Lagoon deploy project prefix');
58-
58+
5959
$orgId = $this->option('org-id') ?? $this->ask('Lagoon deploy organization ID');
60-
60+
6161
$aiRegionId = $this->option('ai-region-id') ?? $this->ask('Amazee AI backend region ID');
62-
62+
6363
$groupName = $this->option('group-name') ?? $this->ask('Lagoon deploy group name');
6464

6565
// Check if all required values are set
6666
if (empty($name) || empty($status) || empty($regionId) || empty($prefix) || empty($orgId) || empty($aiRegionId) || empty($groupName)) {
6767
$this->error('All fields are required. Exiting...');
68+
6869
return 1;
6970
}
7071

7172
// Get deploy key - allow override
7273
$customDeployKey = $this->option('deploy-key');
73-
74-
if (!$customDeployKey && $this->confirm('Do you want to use a custom deploy private key? (Press no to use default from config)')) {
74+
75+
if (! $customDeployKey && $this->confirm('Do you want to use a custom deploy private key? (Press no to use default from config)')) {
7576
$this->info('Please paste your private key (multi-line input supported):');
7677
$customDeployKey = $this->secret('Deploy private key');
7778
}
78-
79+
7980
if ($customDeployKey) {
8081
$deployKey = $customDeployKey;
8182
} else {
8283
$deployKey = file_get_contents(config('polydock.lagoon_deploy_private_key_file'));
8384
}
8485

85-
if(empty($deployKey)) {
86-
$this->error("No deploy key available - either provide one or ensure config file exists");
86+
if (empty($deployKey)) {
87+
$this->error('No deploy key available - either provide one or ensure config file exists');
88+
8789
return 1;
8890
}
8991

@@ -97,11 +99,11 @@ public function handle()
9799
'lagoon_deploy_organization_id_ext' => $orgId,
98100
'lagoon_deploy_private_key' => $deployKey,
99101
'amazee_ai_backend_region_id_ext' => $aiRegionId,
100-
'lagoon_deploy_group_name' => $groupName
102+
'lagoon_deploy_group_name' => $groupName,
101103
]);
102104

103105
$this->info("✅ Store '{$store->name}' created successfully with ID: {$store->id}");
104-
106+
105107
return 0;
106108
}
107109
}

app/Console/Commands/CreateStoreApp.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ public function handle()
4444

4545
// Get all stores for selection
4646
$stores = PolydockStore::all();
47-
47+
4848
if ($stores->isEmpty()) {
4949
$this->error('No stores found. Please create a store first.');
50+
5051
return 1;
5152
}
5253

5354
// Select store
5455
$storeId = $this->option('store-id');
55-
if (!$storeId) {
56+
if (! $storeId) {
5657
$storeOptions = $stores->mapWithKeys(function ($store) {
5758
return [$store->id => "{$store->name} (ID: {$store->id})"];
5859
})->toArray();
@@ -63,8 +64,9 @@ public function handle()
6364

6465
// Validate store exists
6566
$store = PolydockStore::find($storeId);
66-
if (!$store) {
67+
if (! $store) {
6768
$this->error("Store with ID {$storeId} not found.");
69+
6870
return 1;
6971
}
7072

@@ -77,32 +79,33 @@ public function handle()
7779
$supportEmail = $this->option('support-email') ?? $this->ask('Support email');
7880
$git = $this->option('git') ?? $this->ask('Lagoon deploy git repository');
7981
$branch = $this->option('branch') ?? $this->ask('Lagoon deploy branch');
80-
82+
8183
$statusInput = $this->option('status') ?? $this->choice('App status', [
8284
'available' => 'Available',
8385
'unavailable' => 'Unavailable',
84-
'deprecated' => 'Deprecated'
86+
'deprecated' => 'Deprecated',
8587
]);
86-
$status = match($statusInput) {
88+
$status = match ($statusInput) {
8789
'available', 'Available' => PolydockStoreAppStatusEnum::AVAILABLE,
8890
'unavailable', 'Unavailable' => PolydockStoreAppStatusEnum::UNAVAILABLE,
8991
'deprecated', 'Deprecated' => PolydockStoreAppStatusEnum::DEPRECATED,
9092
default => PolydockStoreAppStatusEnum::AVAILABLE
9193
};
92-
94+
9395
$trialsInput = $this->option('trials') ?? $this->choice('Available for trials?', ['true', 'false']);
9496
$trials = filter_var($trialsInput, FILTER_VALIDATE_BOOLEAN);
95-
97+
9698
$targetInstances = $this->option('target-instances') ?? $this->ask('Target unallocated app instances');
97-
if($targetInstances == "") {
99+
if ($targetInstances == '') {
98100
$targetInstances = 0;
99101
}
100102

101103
// Check if all required values are set
102-
if (empty($name) || empty($appClass) || empty($description) || empty($author) ||
103-
empty($website) || empty($supportEmail) || empty($git) || empty($branch) ||
104+
if (empty($name) || empty($appClass) || empty($description) || empty($author) ||
105+
empty($website) || empty($supportEmail) || empty($git) || empty($branch) ||
104106
($targetInstances != 0 && empty($targetInstances))) {
105107
$this->error('All fields are required. Exiting...');
108+
106109
return 1;
107110
}
108111

@@ -125,8 +128,8 @@ public function handle()
125128
$this->info("✅ App '{$storeApp->name}' created successfully in store '{$store->name}' with ID: {$storeApp->id}");
126129
$this->line(" App Class: {$storeApp->polydock_app_class}");
127130
$this->line(" Git Repository: {$storeApp->lagoon_deploy_git}");
128-
$this->line(" Available for Trials: " . ($storeApp->available_for_trials ? 'Yes' : 'No'));
129-
131+
$this->line(' Available for Trials: '.($storeApp->available_for_trials ? 'Yes' : 'No'));
132+
130133
return 0;
131134
}
132135
}

app/Console/Commands/DispatchEnsureUnallocatedAppInstancesJobCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ class DispatchEnsureUnallocatedAppInstancesJobCommand extends Command
2828
public function handle(): int
2929
{
3030
$this->info('Dispatching EnsureUnallocatedAppInstancesJob...');
31-
31+
3232
Log::info('Dispatching EnsureUnallocatedAppInstancesJob via command');
3333

3434
try {
3535
EnsureUnallocatedAppInstancesJob::dispatch()->onQueue('unallocated-instance-creation');
36-
36+
3737
$this->info('Job dispatched successfully');
3838
Log::info('EnsureUnallocatedAppInstancesJob dispatched successfully via command');
39-
39+
4040
return Command::SUCCESS;
4141
} catch (\Exception $e) {
42-
$this->error('Failed to dispatch job: ' . $e->getMessage());
42+
$this->error('Failed to dispatch job: '.$e->getMessage());
4343
Log::error('Failed to dispatch EnsureUnallocatedAppInstancesJob via command', [
4444
'error' => $e->getMessage(),
45-
'trace' => $e->getTraceAsString()
45+
'trace' => $e->getTraceAsString(),
4646
]);
47-
47+
4848
return Command::FAILURE;
4949
}
5050
}

app/Console/Commands/DispatchMidtrialEmailJobsCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function handle()
4848
if ($eligibleInstances->isEmpty()) {
4949
$this->info('No eligible app instances found for midtrial emails.');
5050
Log::info('No eligible app instances found for midtrial emails.');
51+
5152
return;
5253
}
5354

@@ -63,4 +64,4 @@ public function handle()
6364
$this->info('All jobs dispatched successfully.');
6465
Log::info('All jobs dispatched successfully.');
6566
}
66-
}
67+
}

app/Console/Commands/DispatchOneDayLeftEmailJobsCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ public function handle()
4848
if ($eligibleInstances->isEmpty()) {
4949
$this->info('No eligible app instances found for one day left emails.');
5050
Log::info('No eligible app instances found for one day left emails.');
51+
5152
return;
5253
}
5354

5455
$this->info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
5556
Log::info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
56-
57+
5758
// Dispatch jobs for each eligible instance
5859
foreach ($eligibleInstances as $instance) {
5960
$this->info(sprintf('Dispatching one day left email job for app instance %s (%s)', $instance->name, $instance->uuid));
@@ -64,4 +65,4 @@ public function handle()
6465
$this->info('All jobs dispatched successfully.');
6566
Log::info('All jobs dispatched successfully.');
6667
}
67-
}
68+
}

app/Console/Commands/DispatchTrialCompleteEmailJobsCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ public function handle()
4848
if ($eligibleInstances->isEmpty()) {
4949
$this->info('No eligible app instances found for trial complete emails.');
5050
Log::info('No eligible app instances found for trial complete emails.');
51+
5152
return;
5253
}
5354

5455
$this->info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
5556
Log::info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
56-
57+
5758
// Dispatch jobs for each eligible instance
5859
foreach ($eligibleInstances as $instance) {
5960
$this->info(sprintf('Dispatching trial complete email job for app instance %s (%s)', $instance->name, $instance->uuid));
@@ -64,4 +65,4 @@ public function handle()
6465
$this->info('All jobs dispatched successfully.');
6566
Log::info('All jobs dispatched successfully.');
6667
}
67-
}
68+
}

app/Console/Commands/DispatchTrialCompleteStageRemovalJobsCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ public function handle()
4545
if ($eligibleInstances->isEmpty()) {
4646
$this->info('No eligible app instances found for trial complete stage removal.');
4747
Log::info('No eligible app instances found for trial complete stage removal.');
48+
4849
return;
4950
}
5051

5152
$this->info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
5253
Log::info(sprintf('Found %d eligible app instances. Dispatching jobs...', $eligibleInstances->count()));
53-
54+
5455
// Dispatch jobs for each eligible instance
5556
foreach ($eligibleInstances as $instance) {
5657
$this->info(sprintf('Dispatching trial complete stage removal job for app instance %s (%s)', $instance->name, $instance->uuid));
@@ -61,4 +62,4 @@ public function handle()
6162
$this->info('All jobs dispatched successfully.');
6263
Log::info('All jobs dispatched successfully.');
6364
}
64-
}
65+
}

app/Console/Commands/PollDeploymentStatusCommand.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
class PollDeploymentStatusCommand extends Command
1212
{
1313
protected $signature = 'polydock:poll-deployment-status';
14+
1415
protected $description = 'Poll deployment status for running instances';
1516

1617
private const LOOP_DURATION = 300; // 5 minutes
18+
1719
private const SLEEP_DURATION = 5; // 5 seconds
20+
1821
private const MAX_INSTANCES = 10;
1922

2023
public function handle(): int
@@ -24,7 +27,7 @@ public function handle(): int
2427
Log::info('Starting deployment status polling loop', [
2528
'duration' => self::LOOP_DURATION,
2629
'sleep' => self::SLEEP_DURATION,
27-
'max_instances' => self::MAX_INSTANCES
30+
'max_instances' => self::MAX_INSTANCES,
2831
]);
2932

3033
while (now()->lt($endTime)) {
@@ -43,19 +46,20 @@ public function handle(): int
4346

4447
foreach ($instances as $instance) {
4548
Log::info('Dispatching PollDeploymentJob', [
46-
'app_instance_id' => $instance->id
49+
'app_instance_id' => $instance->id,
4750
]);
4851

4952
PollDeploymentJob::dispatch($instance->id)
5053
->onQueue('polydock-app-instance-processing-deploy');
5154
}
5255
}
5356

54-
$this->info("Processed {$count} instances, sleeping for " . self::SLEEP_DURATION . " seconds...");
57+
$this->info("Processed {$count} instances, sleeping for ".self::SLEEP_DURATION.' seconds...');
5558
sleep(self::SLEEP_DURATION);
5659
}
5760

5861
Log::info('Deployment status polling loop completed');
62+
5963
return Command::SUCCESS;
6064
}
61-
}
65+
}

0 commit comments

Comments
 (0)