Completed
Pull Request — master (#949)
by Grégoire
02:40
created

GlobFinder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 15
ccs 5
cts 6
cp 0.8333
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A findMigrations() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations\Finder;
6
7
use function glob;
8
use function rtrim;
9
10
/**
11
 * The GlobFinder class finds migrations in a directory using the PHP glob() function.
12
 */
13
final class GlobFinder extends Finder
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18 36
    public function findMigrations(string $directory, ?string $namespace = null) : array
19
    {
20 36
        $dir = $this->getRealPath($directory);
21
22 34
        $files = glob(rtrim($dir, '/') . '/Version*.php');
23 34
        if ($files === false) {
24
            $files = [];
25
        }
26
27 34
        return $this->loadMigrations($files, $namespace);
28
    }
29
}
30