fix(formating)

This commit is contained in:
Anatoliy Poloz
2026-01-28 03:36:26 +03:00
parent 1723177949
commit b15d29f8e9
313 changed files with 1863 additions and 1533 deletions

View File

@@ -5,13 +5,18 @@ use Apoloz\AlfaBank\Core\AlfaConfig;
/**
* Define a mock app() helper for tests running outside of Laravel.
*/
if (!function_exists('app')) {
function app($abstract = null, array $parameters = []) {
if (! function_exists('app')) {
function app($abstract = null, array $parameters = [])
{
static $container = [];
if ($abstract === null) {
return new class {
public function make($abstract) { return app($abstract); }
return new class
{
public function make($abstract)
{
return app($abstract);
}
};
}
@@ -21,7 +26,10 @@ if (!function_exists('app')) {
// Minimal implementations for laravel-data
if ($abstract === \Spatie\LaravelData\Support\DataConfig::class) {
if (isset($container[$abstract])) return $container[$abstract];
if (isset($container[$abstract])) {
return $container[$abstract];
}
return $container[$abstract] = \Spatie\LaravelData\Support\DataConfig::createFromConfig(config('data'));
}
@@ -40,7 +48,7 @@ if (!function_exists('app')) {
$constructor = $reflector->getConstructor();
if (is_null($constructor)) {
return $container[$abstract] = new $abstract();
return $container[$abstract] = new $abstract;
}
$dependencies = [];
@@ -67,8 +75,9 @@ if (!function_exists('app')) {
/**
* Define a mock config() helper for tests running outside of Laravel.
*/
if (!function_exists('config')) {
function config($key = null, $default = null) {
if (! function_exists('config')) {
function config($key = null, $default = null)
{
$dataConfig = [
'validation_strategy' => 'disabled',
'transformers' => [],
@@ -101,10 +110,11 @@ if (!function_exists('config')) {
if (array_key_exists($subKey, $dataConfig)) {
return $dataConfig[$subKey];
}
// Handle features.key
// Handle features.key
if (str_starts_with($subKey, 'features.')) {
$featureKey = substr($subKey, 9);
return $dataConfig['features'][$featureKey] ?? $default;
$featureKey = substr($subKey, 9);
return $dataConfig['features'][$featureKey] ?? $default;
}
}
@@ -115,11 +125,12 @@ if (!function_exists('config')) {
/**
* Helper to create a test config.
*/
function createTestConfig(): AlfaConfig {
function createTestConfig(): AlfaConfig
{
// Create temp files to satisfy file_exists checks
$cert = tempnam(sys_get_temp_dir(), 'cert');
$key = tempnam(sys_get_temp_dir(), 'key');
return new AlfaConfig(
baseUrl: 'https://test.alfabank.ru',
certificatePath: $cert,