mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-02 04:08:21 +08:00
update
This commit is contained in:
parent
a976e0870c
commit
a434f127ac
@ -10,11 +10,14 @@ use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Supports\Config;
|
||||
use Yansongda\Supports\Str;
|
||||
|
||||
if (!function_exists('should_http_request')) {
|
||||
function should_http_request(Rocket $rocket): bool
|
||||
if (!function_exists('should_do_http_request')) {
|
||||
function should_do_http_request(Rocket $rocket): bool
|
||||
{
|
||||
return NoHttpRequestParser::class !== $rocket->getDirection() &&
|
||||
!in_array(NoHttpRequestParser::class, class_parents($rocket->getDirection()));
|
||||
$direction = $rocket->getDirection();
|
||||
|
||||
return is_null($direction) ||
|
||||
(NoHttpRequestParser::class !== $direction &&
|
||||
!in_array(NoHttpRequestParser::class, class_parents($direction)));
|
||||
}
|
||||
}
|
||||
|
||||
|
13
src/Pay.php
13
src/Pay.php
@ -120,6 +120,8 @@ class Pay
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public static function set(string $name, $value): void
|
||||
{
|
||||
@ -148,6 +150,9 @@ class Pay
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public static function has(string $service): bool
|
||||
{
|
||||
return Pay::getContainer()->has($service);
|
||||
@ -157,10 +162,16 @@ class Pay
|
||||
* getContainer.
|
||||
*
|
||||
* @author yansongda <me@yansongda.cn>
|
||||
*
|
||||
* @throws \Yansongda\Pay\Exception\ContainerException
|
||||
*/
|
||||
public static function getContainer(): Container
|
||||
{
|
||||
return self::$container;
|
||||
if (self::$container) {
|
||||
return self::$container;
|
||||
}
|
||||
|
||||
throw new ContainerException('You should init/config PAY first', ContainerException::CONTAINER_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ class LaunchPlugin implements PluginInterface
|
||||
/* @var Rocket $rocket */
|
||||
$rocket = $next($rocket);
|
||||
|
||||
if (!should_http_request($rocket)) {
|
||||
if (!should_do_http_request($rocket)) {
|
||||
return $rocket;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ abstract class AbstractProvider
|
||||
*/
|
||||
public function ignite(Rocket $rocket): Rocket
|
||||
{
|
||||
if (!should_http_request($rocket)) {
|
||||
if (!should_do_http_request($rocket)) {
|
||||
return $rocket;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user