This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => [
Finder::create()->files()->in( 'vendor/symfony/dependency-injection' )->name( [
'Container.php', 'ContainerInterface.php', 'ResettableContainerInterface.php', 'LICENSE', 'composer.json'
] ),
Finder::create()->files()->in( 'vendor/symfony/dependency-injection/Argument' )->name( [ 'RewindableGenerator.php' ] ),
Finder::create()->files()->in( 'vendor/symfony/dependency-injection/Exception' )->name( [
'InvalidArgumentException.php', 'LogicException.php', 'RuntimeException.php',
'ServiceCircularReferenceException.php', 'ServiceNotFoundException.php', 'EnvNotFoundException.php',
'ParameterCircularReferenceException.php', 'ExceptionInterface.php'
] ),
Finder::create()->files()->in( 'vendor/symfony/dependency-injection/ParameterBag' )->name( [
'FrozenParameterBag.php', 'ParameterBagInterface.php', 'EnvPlaceholderParameterBag.php', 'ParameterBag.php'
] ),
],
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => [],
);

View File

@@ -0,0 +1,56 @@
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => [
Finder::create()->files()->in( 'vendor/guzzlehttp/guzzle' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
Finder::create()->files()->in( 'vendor/guzzlehttp/promises' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
Finder::create()->files()->in( 'vendor/guzzlehttp/psr7' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
],
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => [
/**
* Replaces the Adapter string references with the prefixed versions.
*
* @param string $filePath The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
// 18 is the length of the GrantFactory.php file path.
if ( substr( $file_path, -18 ) !== 'src/Middleware.php' ) {
return $content;
}
$replaced = str_replace(
sprintf( '%s\\\\cookies must be an instance of GuzzleHttp\\\\Cookie\\\\CookieJarInterface', $prefix ),
sprintf( 'cookies must be an instance of %s\\\\GuzzleHttp\\\\Cookie\\\\CookieJarInterface', $prefix ),
$content
);
return $replaced;
},
],
);

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types = 1);
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => array(
Finder::create()->files()->in( 'vendor/j4mie/idiorm' )->name( [ 'idiorm.php', 'LICENSE', 'composer.json' ] ),
),
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => array(),
/*
* By default, PHP-Scoper will not prefix the user defined constants, classes and functions belonging to the global
* namespace. You can however change that setting for them to be prefixed as usual unless explicitly whitelisted.
*
* https://github.com/humbug/php-scoper#whitelist
*/
'whitelist-global-classes' => false,
);

View File

@@ -0,0 +1,54 @@
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => [
Finder::create()->files()->in( 'vendor/league/oauth2-client' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
],
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => [
/**
* Replaces the Adapter string references with the prefixed versions.
*
* @param string $filePath The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
// 26 is the length of the GrantFactory.php file path.
if ( substr( $file_path, -26 ) !== 'src/Grant/GrantFactory.php' ) {
return $content;
}
$replaced = str_replace(
'$class = \'League\\\\OAuth2\\\\Client\\\\Grant\\\\\' . $class;',
sprintf( '$class = \'%s\\\\League\\\\OAuth2\\\\Client\\\\Grant\\\\\' . $class;', $prefix ),
$content
);
return $replaced;
},
],
);

View File

@@ -0,0 +1,32 @@
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => [
Finder::create()->files()->in( 'vendor/psr/container' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
Finder::create()->files()->in( 'vendor/psr/http-message' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
Finder::create()->files()->in( 'vendor/psr/log' )->exclude( 'Test' )->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
],
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => [],
);

View File

@@ -0,0 +1,145 @@
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return array(
/*
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths
*/
'finders' => array(
Finder::create()->files()->in( 'vendor/ruckusing/ruckusing-migrations' )
->exclude( [ 'config', 'tests', 'lib/Task/Hello' ] )
->name( [ '*.php', 'LICENSE', 'composer.json' ] ),
),
/*
* When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
* original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited
* support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your
* heart contents.
*
* For more see: https://github.com/humbug/php-scoper#patchers
*/
'patchers' => array(
/**
* Replaces the Adapter string references with the prefixed versions.
*
* @param string $filePath The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
if ( substr( $file_path, -33 ) !== 'lib/Ruckusing/FrameworkRunner.php' ) {
return $content;
}
$replaced = preg_replace(
'/\$adapter_class = "Ruckusing_Adapter_(MySQL|PgSQL|Sqlite3)_Base"/',
sprintf( '$adapter_class = "\%s\Ruckusing_Adapter_\\1_Base"', $prefix ),
$content
);
$replaced = str_replace(
"\set_error_handler(array('Ruckusing_Exception', 'errorHandler'), \E_ALL);",
sprintf( '\set_error_handler(array(\'\%s\Ruckusing_Exception\', \'errorHandler\'), \E_ALL);', $prefix ),
$replaced
);
$replaced = str_replace(
"\set_exception_handler(array('Ruckusing_Exception', 'exceptionHandler'));",
sprintf( '\set_exception_handler(array(\'\%s\Ruckusing_Exception\', \'exceptionHandler\'));', $prefix ),
$replaced
);
return $replaced;
},
/**
* Replaces a string reference to a class with the prefixed version.
*
* @param string $file_path The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
if ( substr( $file_path, -27 ) !== 'Ruckusing/Util/Migrator.php' ) {
return $content;
}
$replaced = str_replace(
'"Ruckusing_Util_Migrator"',
sprintf( '"\%s\Ruckusing_Util_Migrator"', $prefix ),
$content
);
return $replaced;
},
/**
* Prefixes the Namespace prefix define.
*
* @param string $file_path The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
if ( substr( $file_path, -25 ) !== 'Ruckusing/Util/Naming.php' ) {
return $content;
}
$replaced = str_replace(
'const CLASS_NS_PREFIX = \'Task_\'',
sprintf( 'const CLASS_NS_PREFIX = \'\%s\Task_\'', $prefix ),
$content
);
return $replaced;
},
/**
* Escapes the namespace for use in a regex match.
*
* @param string $file_path The path of the current file.
* @param string $prefix The prefix to be used.
* @param string $content The content of the specific file.
*
* @return string The modified content.
*/
function( $file_path, $prefix, $content ) {
if ( substr( $file_path, -25 ) !== 'Ruckusing/Util/Naming.php' ) {
return $content;
}
$replaced = str_replace(
'preg_match(\'/\' . self::CLASS_NS_PREFIX . \'/\'',
'preg_match(\'/\' . preg_quote(self::CLASS_NS_PREFIX) . \'/\'',
$content
);
return $replaced;
},
),
/*
* By default, PHP-Scoper will not prefix the user defined constants, classes and functions belonging to the global
* namespace. You can however change that setting for them to be prefixed as usual unless explicitly whitelisted.
*
* https://github.com/humbug/php-scoper#whitelist
*/
'whitelist-global-constants' => false,
'whitelist-global-classes' => false,
'whitelist' => [ 'FALSE', 'NULL' ],
);