Passed
Push — master ( 229462...d74785 )
by Andreas
02:20 queued 14s
created

AbstractFileLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDirectoryRelativeToFile() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations\Configuration\Loader;
6
7
use function dirname;
8
use function realpath;
9
10
/**
11
 * @internal
12
 */
13
abstract class AbstractFileLoader implements Loader
14
{
15
    /**
16
     * @param array<string,string> $input
17
     *
18
     * @return array<string,string>
19
     */
20 12
    final protected function getDirectoryRelativeToFile(string $file, array $input) : array
21
    {
22 12
        foreach ($input as $ns => $dir) {
23 12
            $path = realpath(dirname($file) . '/' . $dir);
24
25 12
            $input[$ns] = $path !== false ? $path : $dir;
26
        }
27
28 12
        return $input;
29
    }
30
}
31