| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function handle() |
||
| 22 | { |
||
| 23 | if ($this->snapshots->isEmpty()) { |
||
| 24 | $this->warn("There currently are no snapshots. You can take a snapshot by running `php artisan event-projector:create-snapshot`."); |
||
| 25 | |||
| 26 | return; |
||
| 27 | } |
||
| 28 | |||
| 29 | $this->displaySnapshots(); |
||
| 30 | |||
| 31 | $snapshotNumber = $this->ask('Which snapshot would you like to delete?'); |
||
| 32 | |||
| 33 | if (! $snapshot = $this->snapshots->get($snapshotNumber)) { |
||
| 34 | $this->error("There is no snapshot for that number."); |
||
| 35 | |||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | $snapshot->delete(); |
||
| 40 | |||
| 41 | $this->comment("Snapshot number {$snapshotNumber} deleted!"); |
||
| 42 | } |
||
| 43 | |||
| 61 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: