Passed
Pull Request — master (#562)
by Mike
08:34
created

GlobFinder::findMigrations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Doctrine\DBAL\Migrations\Finder;
4
5
/**
6
 * A MigrationFinderInterface implementation that uses `glob` and some special file and
7
 * class names to load migrations from a directory.
8
 *
9
 * The migrations are expected to reside in files with the filename
10
 * `VersionYYYYMMDDHHMMSS.php`. Each file should contain one class named
11
 * `VersionYYYYMMDDHHMMSS`.
12
 *
13
 * @since   1.0.0-alpha3
14
 */
15
final class GlobFinder extends AbstractFinder
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 3
    public function findMigrations($directory, $namespace = null)
21
    {
22 3
        $dir = $this->getRealPath($directory);
23
24 1
        $files = glob(rtrim($dir, '/') . '/Version*.php');
25
26 1
        return $this->loadMigrations($files, $namespace);
27
    }
28
}
29