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

GlobFinder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 14
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A findMigrations() 0 8 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