-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathscoper.inc.php
More file actions
72 lines (69 loc) · 2.94 KB
/
scoper.inc.php
File metadata and controls
72 lines (69 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
return [
'prefix' => 'PleskRoute53',
'finders' => [
Finder::create()
->files()
->ignoreVCS(true)
->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock|Dockerfile/')
->exclude([
'resources',
'views',
'doc',
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
])
->in('src/plib'),
],
'patchers' => [
function (string $filePath, string $prefix, string $contents): string {
if (preg_match("#/aws-sdk-php/src/Sdk.php$#", $filePath)
|| preg_match("#/aws-sdk-php/src/AwsClient.php$#", $filePath)
|| preg_match("#/aws-sdk-php/src/MultiRegionClient.php$#", $filePath)
) {
return preg_replace("#\"Aws\\\\#", "\"$prefix\\\\\\\\Aws\\", $contents);
}
return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
if (preg_match("#/aws-sdk-php/src/Signature/SignatureV4.php$#", $filePath)) {
return preg_replace("#ISO8601_BASIC = \'[a-zA-Z0-9\\\]{1,}#", "ISO8601_BASIC = 'Ymd\THis\Z", $contents);
}
return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
if (preg_match("#/aws-sdk-php/src/Endpoint/UseFipsEndpoint/Configuration.php$#", $filePath)
|| preg_match("#/aws-sdk-php/src/S3/UseArnRegion/Configuration.php$#", $filePath)
|| preg_match("#/aws-sdk-php/src/Endpoint/UseDualstackEndpoint/Configuration.php$#", $filePath)) {
return preg_replace("#Aws\\\\boolean_value#", "\\$prefix\\\\Aws\\\\boolean_value", $contents);
}
return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
if (preg_match("#/aws-sdk-php/src/functions.php$#", $filePath)) {
return preg_replace("#GuzzleHttp\\\\\\\\ClientInterface::#", "$prefix\\\\\\\\GuzzleHttp\\\\\\\\ClientInterface::", $contents);
}
return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
if (preg_match("#/aws-sdk-php/src/EndpointV2/Ruleset/RulesetStandardLibrary.php$#", $filePath)) {
return preg_replace("#\'Aws\\\\\\\\EndpointV2#", "'$prefix\\\\\\\\Aws\\\\\\\\EndpointV2", $contents);
}
return $contents;
},
],
'exclude-namespaces' => [
'~^Plesk~',
'Psr',
'~^$~',
],
'expose-global-constants' => false,
'expose-global-classes' => false,
'expose-global-functions' => false,
];