Skip to content

Commit

Permalink
SP-674
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarzybok-sumoheavy committed Sep 19, 2023
1 parent 2a22106 commit bbb8275
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 75 deletions.
2 changes: 1 addition & 1 deletion vendorPrefixed/BitPayLib/class-bitpayclientfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ private function get_environment() : string
if ('production' === \strtolower($environment)) {
return Env::PROD;
}
throw new \RuntimeException('Wrong environment ' . $environment);
throw new \RuntimeException('Wrong environment ' . esc_html($environment));
}
}
4 changes: 2 additions & 2 deletions vendorPrefixed/BitPayLib/class-bitpayipnprocess.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function validate_bitpay_status_in_available_statuses(Invoice $bitpay_in
if (!\in_array($status, $available_statuses, \true)) {
$message = 'Wrong BitPay status. Status: ' . $status . ' available statuses: ' . \print_r($available_statuses, \true);
// phpcs:ignore
throw new \RuntimeException($message);
throw new \RuntimeException(esc_html($message));
}
}
private function get_wc_order_statuses() : array
Expand All @@ -118,7 +118,7 @@ private function get_bitpay_dashboard_link(string $invoice_id) : string
if ('test' === $env) {
return '//test.bitpay.com/dashboard/payments/' . $invoice_id;
}
throw new \RuntimeException('Wrong BitPay Environment ' . $env);
throw new \RuntimeException('Wrong BitPay Environment ' . esc_html($env));
}
private function process_confirmed(Invoice $bitpay_invoice, WC_Order $order) : void
{
Expand Down
2 changes: 1 addition & 1 deletion vendorPrefixed/BitPayLib/class-bitpaylogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function execute($msg, string $type, bool $is_array = \false, $error = \f
$bitpay_checkout_options = get_option('woocommerce_bitpay_checkout_gateway_settings');
$log_directory = plugin_dir_path(__FILE__) . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'logs/';
if (!\file_exists($log_directory) && !\mkdir($log_directory) && !\is_dir($log_directory)) {
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $log_directory));
throw new \RuntimeException(\sprintf('Directory "%s" was not created', esc_html($log_directory)));
}
$transaction_log = $log_directory . \date('Ymd') . '_transactions.log';
// phpcs:ignore
Expand Down
2 changes: 1 addition & 1 deletion vendorPrefixed/vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitcb1b6c757473ea3fd79a32744f45be16::getLoader();
return ComposerAutoloaderInitffe20d458e05e78e2995f3c4709720b3::getLoader();
5 changes: 2 additions & 3 deletions vendorPrefixed/vendor/bin/yaml-lint
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ if (\PHP_VERSION_ID < 80000) {
}
}
if (\function_exists('stream_get_wrappers') && \in_array('phpvfscomposer', \stream_get_wrappers(), \true) || \function_exists('stream_wrapper_register') && \stream_wrapper_register('phpvfscomposer', 'BitPayVendor\\Composer\\BinProxyWrapper')) {
include "phpvfscomposer://" . __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint';
exit(0);
return include "phpvfscomposer://" . __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint';
}
}
include __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint';
return include __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint';
96 changes: 45 additions & 51 deletions vendorPrefixed/vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,66 +45,63 @@ class ClassLoader
/** @var \Closure(string):void */
private static $includeFile;

/** @var ?string */
/** @var string|null */
private $vendorDir;

// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr4 = array();

// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr0 = array();

/** @var bool */
private $useIncludePath = false;

/**
* @var string[]
* @psalm-var array<string, string>
* @var array<string, string>
*/
private $classMap = array();

/** @var bool */
private $classMapAuthoritative = false;

/**
* @var bool[]
* @psalm-var array<string, bool>
* @var array<string, bool>
*/
private $missingClasses = array();

/** @var ?string */
/** @var string|null */
private $apcuPrefix;

/**
* @var self[]
* @var array<string, self>
*/
private static $registeredLoaders = array();

/**
* @param ?string $vendorDir
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
Expand All @@ -113,7 +110,7 @@ public function __construct($vendorDir = null)
}

/**
* @return string[]
* @return array<string, list<string>>
*/
public function getPrefixes()
{
Expand All @@ -125,44 +122,39 @@ public function getPrefixes()
}

/**
* @return array[]
* @psalm-return array<string, array<int, string>>
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}

/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}

/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}

/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}

/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
Expand All @@ -179,24 +171,25 @@ public function addClassMap(array $classMap)
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
$paths
);
}

Expand All @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false)

$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
$this->prefixesPsr0[$first][$prefix] = $paths;

return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
$paths
);
}
}
Expand All @@ -226,27 +219,28 @@ public function add($prefix, $paths, $prepend = false)
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
Expand All @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false)
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
$paths
);
}
}
Expand All @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false)
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
Expand All @@ -294,8 +288,8 @@ public function set($prefix, $paths)
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
Expand Down Expand Up @@ -481,9 +475,9 @@ public function findFile($class)
}

/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return self[]
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
Expand Down
16 changes: 11 additions & 5 deletions vendorPrefixed/vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static function isInstalled($packageName, $includeDevRequirements = \true
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === \false;
}
}
return \false;
Expand All @@ -106,7 +106,7 @@ public static function isInstalled($packageName, $includeDevRequirements = \true
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
Expand Down Expand Up @@ -285,7 +285,9 @@ private static function getInstalled()
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (\is_file($vendorDir . '/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = (require $vendorDir . '/composer/installed.php');
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = (require $vendorDir . '/composer/installed.php');
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && \strtr($vendorDir . '/composer', '\\', '/') === \strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[\count($installed) - 1];
}
Expand All @@ -296,12 +298,16 @@ private static function getInstalled()
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (\substr(__DIR__, -8, 1) !== 'C') {
self::$installed = (require __DIR__ . '/installed.php');
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = (require __DIR__ . '/installed.php');
self::$installed = $required;
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}
Loading

0 comments on commit bbb8275

Please sign in to comment.