Completed
Push — stable ( 86ecc3...3a45ea )
by Nuno
07:34
created

Migrator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 25
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMigrationFiles() 0 12 1
1
<?php
2
3
/**
4
 * This file is part of Laravel Zero.
5
 *
6
 * (c) Nuno Maduro <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace LaravelZero\Framework\Components\Database;
13
14
use Symfony\Component\Finder\Finder;
15
use Illuminate\Database\Migrations\Migrator as BaseMigrator;
16
17
/**
18
 * This is the Laravel Zero Framework Database Component Migrator Implementation.
19
 */
20
class Migrator extends BaseMigrator
21
{
22
    /**
23
     * Get all of the migration files in a given path.
24
     *
25
     * Differs from the original `getMigrationFiles` because
26
     * the build feature don't support globs.
27
     *
28
     * @param  string|array  $paths
29
     *
30
     * @return array
31
     */
32
    public function getMigrationFiles($paths)
33
    {
34
        return collect($paths)->flatMap(function ($path) {
35
            return collect((new Finder)->in([$path])->files())->map( function ($file) {
36
                return $file->getPathname();
37
            })->all();
38
        })->filter()->sortBy(function ($file) {
39
            return $this->getMigrationName($file);
40
        })->values()->keyBy(function ($file) {
41
            return $this->getMigrationName($file);
42
        })->all();
43
    }
44
}
45