DeleteLastMigrationAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 10 3
1
<?php
2
3
namespace Mtolhuys\LaravelSchematics\Actions\Migration;
4
5
use Illuminate\Support\Facades\File;
6
use Mtolhuys\LaravelSchematics\Actions\Migration\Traits\DeletesMigrations;
7
8
class DeleteLastMigrationAction
9
{
10
    use DeletesMigrations;
11
12
    /**
13
     * @return string
14
     */
15
    public function execute()
16
    {
17
        $migrations = scandir($this->path);
18
19
        foreach ($migrations as $index => $migration) {
20
            if ($index === count($migrations) - 1) {
21
                File::delete("$this->path/$migration");
22
            }
23
        }
24
    }
25
}
26