-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoper.inc.php
49 lines (44 loc) · 1.19 KB
/
scoper.inc.php
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
<?php
/**
* This file is a PHPScoper configuration file used to add custom namespace to Stripe SDK.
*
* @since 1.0.0
*
* @package stripe-sdk-customiser/stripe-php
*/
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
return [
'prefix' => 'WP', // Add your custom namespace here.
'finders' => [
Finder::create()->files()->in( 'vendor/stripe' ),
Finder::create()
->files()
->ignoreVCS( true )
->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' )
->exclude(
[
'doc',
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
]
)
->in( 'vendor/stripe' ),
],
'patchers' => [
function( string $filePath, string $prefix, string $contents ): string {
preg_match_all( '/use[[:blank:]].Stripe.[^\r\n]*/m', $contents, $matches );
foreach ( $matches as $match ) {
$newstr = substr_replace( $match, '\\' . $prefix, 4, 0 );
$contents = str_replace( $match, $newstr, $contents );
}
return $contents;
},
],
'whitelist-global-constants' => true,
'whitelist-global-constants' => true,
'whitelist-global-functions' => true,
];