| Conditions | 4 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function handle() |
||
| 18 | { |
||
| 19 | $snapShots = app(SnapshotRepository::class)->getAll(); |
||
|
|
|||
| 20 | |||
| 21 | if (app(SnapshotRepository::class)->getAll()->isEmpty()) { |
||
| 22 | $this->warn('No snapshots found. Run `snapshot:create` to create snapshots.'); |
||
| 23 | |||
| 24 | return; |
||
| 25 | } |
||
| 26 | |||
| 27 | $name = $this->argument('name') ?: $this->askForSnapshotName(); |
||
| 28 | |||
| 29 | $snapshot = app(SnapshotRepository::class)->findByName($name); |
||
| 30 | |||
| 31 | if (! $snapshot) { |
||
| 32 | $this->warn("Snapshot `{$name}` does not exist!"); |
||
| 33 | |||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | $snapshot->delete(); |
||
| 38 | |||
| 39 | $this->info("Snapshot `{$snapshot->name}` deleted!"); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.