@@ 33-50 (lines=18) @@ | ||
30 | * |
|
31 | * {@inheritdoc} |
|
32 | */ |
|
33 | public function scope(string $filePath, string $prefix, array $patchers, callable $globalWhitelister): string |
|
34 | { |
|
35 | if (1 !== preg_match('/composer\.json$/', $filePath)) { |
|
36 | return $this->decoratedScoper->scope($filePath, $prefix, $patchers, $globalWhitelister); |
|
37 | } |
|
38 | ||
39 | $decodedJson = json_decode( |
|
40 | file_get_contents($filePath), |
|
41 | true |
|
42 | ); |
|
43 | ||
44 | $decodedJson = AutoloadPrefixer::prefixPackageAutoloads($decodedJson, $prefix); |
|
45 | ||
46 | return json_encode( |
|
47 | $decodedJson, |
|
48 | JSON_PRETTY_PRINT |
|
49 | ); |
|
50 | } |
|
51 | } |
|
52 |
@@ 35-52 (lines=18) @@ | ||
32 | * |
|
33 | * {@inheritdoc} |
|
34 | */ |
|
35 | public function scope(string $filePath, string $prefix, array $patchers, callable $globalWhitelister): string |
|
36 | { |
|
37 | if (1 !== preg_match(self::$filePattern, $filePath)) { |
|
38 | return $this->decoratedScoper->scope($filePath, $prefix, $patchers, $globalWhitelister); |
|
39 | } |
|
40 | ||
41 | $decodedJson = json_decode( |
|
42 | file_get_contents($filePath), |
|
43 | true |
|
44 | ); |
|
45 | ||
46 | $decodedJson = $this->prefixLockPackages($decodedJson, $prefix); |
|
47 | ||
48 | return json_encode( |
|
49 | $decodedJson, |
|
50 | JSON_PRETTY_PRINT |
|
51 | ); |
|
52 | } |
|
53 | ||
54 | private function prefixLockPackages(array $packages, string $prefix): array |
|
55 | { |