Skip to content

Commit ee50ee6

Browse files
Refactor out else statement
1 parent b07dfcf commit ee50ee6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Commands/Create.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ public function handle()
2121
?: config('db-snapshots.default_connection')
2222
?? config('database.default');
2323

24-
if (! is_null($this->option('connection')) && is_null($this->argument('name'))) {
25-
$snapshotName = $this->option('connection') . "_" . Carbon::now()->format('Y-m-d_H-i-s');
26-
} else {
27-
$snapshotName = $this->argument('name') ?? Carbon::now()->format('Y-m-d_H-i-s');
28-
}
24+
$snapshotName = !is_null($this->option('connection')) && is_null($this->argument('name'))
25+
? $this->option('connection')."_".Carbon::now()->format('Y-m-d_H-i-s')
26+
: $this->argument('name') ?? Carbon::now()->format('Y-m-d_H-i-s');
2927

3028
$compress = $this->option('compress') || config('db-snapshots.compress', false);
3129

0 commit comments

Comments
 (0)