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/HttpServiceProvider.php

35 lines
904 B

<?php
declare(strict_types=1);
namespace Yansongda\Pay\Service;
use GuzzleHttp\Client;
use Yansongda\Pay\Contract\ConfigInterface;
use Yansongda\Pay\Contract\HttpClientInterface;
use Yansongda\Pay\Contract\ServiceProviderInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Pay\Pay;
use Yansongda\Supports\Config;
class HttpServiceProvider implements ServiceProviderInterface
{
/**
* @param mixed $data
*
* @throws ContainerException
* @throws ServiceNotFoundException
*/
public function register($data = null): void
{
/* @var Config $config */
$config = Pay::get(ConfigInterface::class);
if (class_exists(Client::class)) {
$service = new Client($config->get('http', []));
Pay::set(HttpClientInterface::class, $service);
}
}
}