You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ymww_backend/addons/epay/library/v3/Yansongda/Pay/Service/ConfigServiceProvider.php

46 lines
1.1 KiB

1 year ago
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Service;
use Yansongda\Pay\Contract\ConfigInterface;
use Yansongda\Pay\Contract\ServiceProviderInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Pay;
use Yansongda\Supports\Config;
class ConfigServiceProvider implements ServiceProviderInterface
{
private array $config = [
'logger' => [
'enable' => false,
'file' => null,
'identify' => 'yansongda.pay',
'level' => 'debug',
'type' => 'daily',
'max_files' => 30,
],
'http' => [
'timeout' => 5.0,
'connect_timeout' => 3.0,
'headers' => [
'User-Agent' => 'yansongda/pay-v3',
],
],
'mode' => Pay::MODE_NORMAL,
];
/**
* @param mixed $data
*
* @throws ContainerException
*/
public function register($data = null): void
{
$config = new Config(array_replace_recursive($this->config, $data ?? []));
Pay::set(ConfigInterface::class, $config);
}
}