Completed
Push — master ( 00f04e...1d93d6 )
by Freek
03:46
created

Composer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\EventSourcing;
4
5
use Illuminate\Support\Str;
6
7
final class Composer
8
{
9
    public static function getAutoloadedFiles($composerJsonPath): array
10
    {
11
        if (! file_exists($composerJsonPath)) {
12
            return [];
13
        }
14
15
        $basePath = Str::before($composerJsonPath, 'composer.json');
16
17
        $composerContents = json_decode(file_get_contents($composerJsonPath), true);
18
19
        $paths = array_merge(
20
            $composerContents['autoload']['files'] ?? [],
21
            $composerContents['autoload-dev']['files'] ?? []
22
        );
23
24
        return array_map(fn(string $path) => realpath($basePath.$path), $paths);
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_VARIABLE, expecting ',' or ')'
Loading history...
25
    }
26
}
27