Skip to content

Commit 7f70d1b

Browse files
committed
level 4
1 parent 2f1e763 commit 7f70d1b

23 files changed

+48
-59
lines changed

app/Actions/Site/CreateSite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function create(Server $server, array $input): Site
4040
// check has access to repository
4141
try {
4242
if ($site->sourceControl) {
43-
$site->sourceControl?->getRepo($site->repository);
43+
$site->sourceControl->getRepo($site->repository);
4444
}
4545
} catch (SourceControlIsNotConnected) {
4646
throw ValidationException::withMessages([

app/Actions/Site/UpdateBranch.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
use App\Exceptions\SSHError;
66
use App\Models\Site;
77
use App\SSH\Git\Git;
8-
use Illuminate\Validation\ValidationException;
98

109
class UpdateBranch
1110
{
1211
/**
13-
* @throws ValidationException
1412
* @throws SSHError
1513
*/
1614
public function update(Site $site, array $input): void
@@ -21,9 +19,6 @@ public function update(Site $site, array $input): void
2119
$site->save();
2220
}
2321

24-
/**
25-
* @throws ValidationException
26-
*/
2722
public static function rules(): array
2823
{
2924
return [

app/Actions/Site/UpdateDeploymentScript.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,16 @@
33
namespace App\Actions\Site;
44

55
use App\Models\Site;
6-
use Illuminate\Validation\ValidationException;
76

87
class UpdateDeploymentScript
98
{
10-
/**
11-
* @throws ValidationException
12-
*/
139
public function update(Site $site, array $input): void
1410
{
1511
$script = $site->deploymentScript;
1612
$script->content = $input['script'];
1713
$script->save();
1814
}
1915

20-
/**
21-
* @throws ValidationException
22-
*/
2316
public static function rules(): array
2417
{
2518
return [

app/Actions/Site/UpdateSourceControl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function update(Site $site, array $input): void
1616
$site->source_control_id = $input['source_control'];
1717
try {
1818
if ($site->sourceControl) {
19-
$site->sourceControl?->getRepo($site->repository);
19+
$site->sourceControl->getRepo($site->repository);
2020
}
2121
} catch (SourceControlIsNotConnected) {
2222
throw ValidationException::withMessages([

app/Actions/SshKey/CreateSshKey.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ public function create(User $user, array $input): SshKey
2424
return $key;
2525
}
2626

27-
/**
28-
* @throws ValidationException
29-
*/
3027
public static function rules(): array
3128
{
3229
return [

app/Actions/StorageProvider/EditStorageProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use App\Models\Project;
66
use App\Models\StorageProvider;
7-
use Illuminate\Validation\ValidationException;
87

98
class EditStorageProvider
109
{
@@ -18,9 +17,6 @@ public function edit(StorageProvider $storageProvider, Project $project, array $
1817
return $storageProvider;
1918
}
2019

21-
/**
22-
* @throws ValidationException
23-
*/
2420
public static function rules(): array
2521
{
2622
return [

app/Actions/User/UpdateProjects.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function update(User $user, array $input): void
2020

2121
$user->refresh();
2222

23-
/** @var Project $firstProject */
23+
/** @var ?Project $firstProject */
2424
$firstProject = $user->projects->first();
2525
if (! $user->currentProject && $firstProject) {
2626
$user->current_project_id = $firstProject->id;

app/Models/Deployment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @property string $status
1717
* @property Site $site
1818
* @property DeploymentScript $deploymentScript
19-
* @property ServerLog $log
19+
* @property ?ServerLog $log
2020
*/
2121
class Deployment extends AbstractModel
2222
{

app/Models/FirewallRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function getStatusColor(): string
4747
FirewallRuleStatus::DELETING => 'warning',
4848
FirewallRuleStatus::READY => 'success',
4949
FirewallRuleStatus::FAILED => 'danger',
50+
default => 'secondary',
5051
};
5152
}
5253

app/Models/Metric.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/**
1111
* @property int $id
1212
* @property int $server_id
13-
* @property float $load
14-
* @property float $memory_total
15-
* @property float $memory_used
16-
* @property float $memory_free
17-
* @property float $disk_total
18-
* @property float $disk_used
19-
* @property float $disk_free
13+
* @property ?float $load
14+
* @property ?float $memory_total
15+
* @property ?float $memory_used
16+
* @property ?float $memory_free
17+
* @property ?float $disk_total
18+
* @property ?float $disk_used
19+
* @property ?float $disk_free
2020
* @property-read float|int $memory_total_in_bytes
2121
* @property-read float|int $memory_used_in_bytes
2222
* @property-read float|int $memory_free_in_bytes
@@ -60,31 +60,31 @@ public function server(): BelongsTo
6060

6161
public function getMemoryTotalInBytesAttribute(): float|int
6262
{
63-
return $this->memory_total * 1024;
63+
return ($this->memory_total ?? 0) * 1024;
6464
}
6565

6666
public function getMemoryUsedInBytesAttribute(): float|int
6767
{
68-
return $this->memory_used * 1024;
68+
return ($this->memory_used ?? 0) * 1024;
6969
}
7070

7171
public function getMemoryFreeInBytesAttribute(): float|int
7272
{
73-
return $this->memory_free * 1024;
73+
return ($this->memory_free ?? 0) * 1024;
7474
}
7575

7676
public function getDiskTotalInBytesAttribute(): float|int
7777
{
78-
return $this->disk_total * (1024 * 1024);
78+
return ($this->disk_total ?? 0) * (1024 * 1024);
7979
}
8080

8181
public function getDiskUsedInBytesAttribute(): float|int
8282
{
83-
return $this->disk_used * (1024 * 1024);
83+
return ($this->disk_used ?? 0) * (1024 * 1024);
8484
}
8585

8686
public function getDiskFreeInBytesAttribute(): float|int
8787
{
88-
return $this->disk_free * (1024 * 1024);
88+
return ($this->disk_free ?? 0) * (1024 * 1024);
8989
}
9090
}

0 commit comments

Comments
 (0)