Skip to content

Commit

Permalink
Small static analysis adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
lancepioch committed Mar 23, 2024
1 parent f7bc9f0 commit 119ef07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/Console/Commands/User/MakeUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ public function handle(): int
['Name', $user->name],
['Admin', $user->root_admin ? 'Yes' : 'No'],
]);

return 0;
}
}
5 changes: 2 additions & 3 deletions app/Services/Backups/InitiateBackupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Services\Backups;

use Ramsey\Uuid\Uuid;
use Carbon\CarbonImmutable;
use Webmozart\Assert\Assert;
use App\Models\Backup;
use App\Models\Server;
Expand Down Expand Up @@ -86,7 +85,7 @@ public function handle(Server $server, string $name = null, bool $override = fal
if ($previous->count() >= $limit) {
$message = sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period);

throw new TooManyRequestsHttpException(CarbonImmutable::now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), $message);
throw new TooManyRequestsHttpException((int) now()->diffInSeconds($previous->last()->created_at->addSeconds($period)), $message);
}
}

Expand Down Expand Up @@ -115,7 +114,7 @@ public function handle(Server $server, string $name = null, bool $override = fal
$backup = Backup::query()->create([
'server_id' => $server->id,
'uuid' => Uuid::uuid4()->toString(),
'name' => trim($name) ?: sprintf('Backup at %s', CarbonImmutable::now()->toDateTimeString()),
'name' => trim($name) ?: sprintf('Backup at %s', now()->toDateTimeString()),
'ignored_files' => array_values($this->ignoredFiles ?? []),
'disk' => $this->backupManager->getDefaultAdapter(),
'is_locked' => $this->isLocked,
Expand Down
2 changes: 1 addition & 1 deletion app/Transformers/Api/Client/ActivityLogTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function properties(ActivityLog $model): object

$properties = $model->properties
->mapWithKeys(function ($value, $key) use ($model) {
if ($key === 'ip' && !$model->actor?->is($this->request->user())) {
if ($key === 'ip' && !$model->actor->is($this->request->user())) {
return [$key => '[hidden]'];
}

Expand Down

0 comments on commit 119ef07

Please sign in to comment.