- 框架初始化
 - 安装插件
 - 修复PHP8.4报错
This commit is contained in:
2025-04-19 17:21:20 +08:00
commit c6a4e1f5f6
5306 changed files with 967782 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface ConfigInterface
{
/**
* @param mixed $default default value of the entry when does not found
*
* @return mixed
*/
public function get(string $key, $default = null);
public function has(string $key): bool;
/**
* @param mixed $value
*/
public function set(string $key, $value): void;
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface ContainerInterface extends \Psr\Container\ContainerInterface
{
/**
* factory make.
*
* @return mixed
*/
public function make(string $name, ?array $parameters = []);
/**
* @param mixed $entry
*
* @return mixed
*/
public function set(string $name, $entry);
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Psr\Http\Message\ResponseInterface;
interface DirectionInterface
{
/**
* @return mixed
*/
public function parse(PackerInterface $packer, ?ResponseInterface $response);
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface EventDispatcherInterface extends \Psr\EventDispatcher\EventDispatcherInterface
{
}

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Psr\Http\Client\ClientInterface;
interface HttpClientInterface extends ClientInterface
{
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface LoggerInterface extends \Psr\Log\LoggerInterface
{
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface PackerInterface
{
public function pack(array $payload): string;
public function unpack(string $payload): ?array;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Closure;
use Yansongda\Pay\Rocket;
interface PluginInterface
{
public function assembly(Rocket $rocket, Closure $next): Rocket;
}

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Yansongda\Pay\Exception\ContainerException;
use Yansongda\Pay\Exception\InvalidParamsException;
use Yansongda\Pay\Exception\ServiceNotFoundException;
use Yansongda\Supports\Collection;
interface ProviderInterface
{
/**
* @return null|array|Collection|MessageInterface
*
* @throws ContainerException
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function pay(array $plugins, ?array $params);
/**
* @param array|string $order
*
* @return array|Collection
*/
public function find($order);
/**
* @param array|string $order
*
* @return array|Collection|void
*/
public function cancel($order);
/**
* @param array|string $order
*
* @return array|Collection|void
*/
public function close($order);
/**
* @return array|Collection
*/
public function refund(array $order);
/**
* @param null|array|ServerRequestInterface $contents
*/
public function callback($contents = null, ?array $params = null): Collection;
public function success(): ResponseInterface;
}

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
use Yansongda\Pay\Exception\ContainerException;
interface ServiceProviderInterface
{
/**
* @param mixed $data
*
* @throws ContainerException
*/
public function register($data = null): void;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Yansongda\Pay\Contract;
interface ShortcutInterface
{
/**
* @return PluginInterface[]|string[]
*/
public function getPlugins(array $params): array;
}