From 7de67356f0e4a7574a357b05fd1036e85b977a96 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 14 Nov 2025 16:05:17 +0800 Subject: [PATCH] 1 --- composer.json | 3 +- vendor/composer/InstalledVersions.php | 49 ++- vendor/composer/autoload_files.php | 3 +- vendor/composer/autoload_psr4.php | 9 +- vendor/composer/autoload_static.php | 41 ++- vendor/composer/installed.json | 346 ++++++++++++++++++ vendor/composer/installed.php | 49 ++- vendor/hyperf/context/.gitattributes | 2 + vendor/hyperf/context/LICENSE | 21 ++ vendor/hyperf/context/composer.json | 40 ++ .../hyperf/context/src/ApplicationContext.php | 39 ++ vendor/hyperf/context/src/Context.php | 125 +++++++ .../context/src/Traits/CoroutineProxy.php | 44 +++ vendor/hyperf/contract/.gitattributes | 2 + vendor/hyperf/contract/LICENSE | 21 ++ vendor/hyperf/contract/composer.json | 33 ++ .../contract/src/ApplicationInterface.php | 21 ++ vendor/hyperf/contract/src/Arrayable.php | 24 ++ vendor/hyperf/contract/src/Castable.php | 22 ++ .../hyperf/contract/src/CastsAttributes.php | 33 ++ .../contract/src/CastsInboundAttributes.php | 24 ++ .../hyperf/contract/src/CompressInterface.php | 17 + .../hyperf/contract/src/ConfigInterface.php | 40 ++ .../contract/src/ConnectionInterface.php | 40 ++ .../contract/src/ContainerInterface.php | 53 +++ .../contract/src/DispatcherInterface.php | 17 + .../contract/src/FrequencyInterface.php | 25 ++ .../hyperf/contract/src/IPReaderInterface.php | 17 + .../contract/src/IdGeneratorInterface.php | 17 + .../contract/src/JsonDeSerializable.php | 17 + vendor/hyperf/contract/src/Jsonable.php | 17 + .../src/LengthAwarePaginatorInterface.php | 30 ++ vendor/hyperf/contract/src/MessageBag.php | 87 +++++ .../hyperf/contract/src/MessageProvider.php | 20 + .../src/MiddlewareInitializerInterface.php | 17 + .../contract/src/NormalizerInterface.php | 34 ++ .../hyperf/contract/src/OnCloseInterface.php | 23 ++ .../contract/src/OnHandShakeInterface.php | 24 ++ .../contract/src/OnMessageInterface.php | 25 ++ .../hyperf/contract/src/OnOpenInterface.php | 25 ++ .../hyperf/contract/src/OnPacketInterface.php | 24 ++ .../contract/src/OnReceiveInterface.php | 24 ++ .../contract/src/OnRequestInterface.php | 21 ++ .../hyperf/contract/src/PackerInterface.php | 19 + .../contract/src/PaginatorInterface.php | 95 +++++ vendor/hyperf/contract/src/PoolInterface.php | 32 ++ .../contract/src/PoolOptionInterface.php | 27 ++ .../hyperf/contract/src/ProcessInterface.php | 36 ++ .../contract/src/ResponseEmitterInterface.php | 22 ++ .../hyperf/contract/src/SessionInterface.php | 160 ++++++++ .../contract/src/StdoutLoggerInterface.php | 18 + vendor/hyperf/contract/src/Synchronized.php | 20 + .../contract/src/TranslatorInterface.php | 39 ++ .../src/TranslatorLoaderInterface.php | 35 ++ .../contract/src/UnCompressInterface.php | 17 + .../contract/src/ValidatorInterface.php | 57 +++ vendor/hyperf/contract/src/Xmlable.php | 17 + vendor/hyperf/engine-contract/.gitattributes | 2 + vendor/hyperf/engine-contract/.gitignore | 6 + .../hyperf/engine-contract/.php-cs-fixer.php | 104 ++++++ .../hyperf/engine-contract/.phpstorm.meta.php | 6 + vendor/hyperf/engine-contract/LICENSE | 21 ++ vendor/hyperf/engine-contract/README.md | 9 + vendor/hyperf/engine-contract/composer.json | 53 +++ vendor/hyperf/engine-contract/phpunit.xml | 15 + .../engine-contract/src/BarrierInterface.php | 28 ++ .../engine-contract/src/ChannelInterface.php | 59 +++ .../src/CoroutineInterface.php | 96 +++++ .../src/DefaultOptionInterface.php | 21 ++ .../src/Http/ClientInterface.php | 23 ++ .../hyperf/engine-contract/src/Http/Http.php | 24 ++ .../src/Http/RawResponseInterface.php | 27 ++ .../src/Http/ServerFactoryInterface.php | 18 + .../src/Http/ServerInterface.php | 22 ++ .../src/Http/V2/ClientFactoryInterface.php | 18 + .../src/Http/V2/ClientInterface.php | 33 ++ .../src/Http/V2/RequestInterface.php | 26 ++ .../src/Http/V2/ResponseInterface.php | 24 ++ .../engine-contract/src/Http/Writable.php | 22 ++ .../src/ResponseEmitterInterface.php | 23 ++ .../engine-contract/src/SignalInterface.php | 18 + .../src/Socket/SocketFactoryInterface.php | 20 + .../src/Socket/SocketOptionInterface.php | 36 ++ .../engine-contract/src/SocketInterface.php | 24 ++ .../src/WebSocket/FrameInterface.php | 73 ++++ .../src/WebSocket/ResponseInterface.php | 28 ++ .../src/WebSocket/WebSocketInterface.php | 24 ++ vendor/hyperf/engine/.gitattributes | 4 + vendor/hyperf/engine/.gitignore | 5 + vendor/hyperf/engine/.php-cs-fixer.php | 95 +++++ vendor/hyperf/engine/.phpstorm.meta.php | 6 + vendor/hyperf/engine/Dockerfile | 44 +++ vendor/hyperf/engine/README.md | 7 + vendor/hyperf/engine/composer.json | 66 ++++ vendor/hyperf/engine/phpunit.xml | 15 + vendor/hyperf/engine/src/Barrier.php | 29 ++ vendor/hyperf/engine/src/Channel.php | 94 +++++ vendor/hyperf/engine/src/ConfigProvider.php | 28 ++ vendor/hyperf/engine/src/Constant.php | 26 ++ .../hyperf/engine/src/Constant/SocketType.php | 28 ++ vendor/hyperf/engine/src/Coroutine.php | 139 +++++++ vendor/hyperf/engine/src/DefaultOption.php | 28 ++ .../Exception/CoroutineDestroyedException.php | 17 + .../src/Exception/HttpClientException.php | 17 + .../Exception/InvalidArgumentException.php | 17 + .../RunningInNonCoroutineException.php | 17 + .../engine/src/Exception/RuntimeException.php | 17 + .../src/Exception/SocketClosedException.php | 17 + .../src/Exception/SocketConnectException.php | 17 + .../src/Exception/SocketTimeoutException.php | 17 + vendor/hyperf/engine/src/Extension.php | 21 ++ vendor/hyperf/engine/src/Functions.php | 40 ++ vendor/hyperf/engine/src/Http/Client.php | 81 ++++ vendor/hyperf/engine/src/Http/EventStream.php | 43 +++ vendor/hyperf/engine/src/Http/FdGetter.php | 23 ++ vendor/hyperf/engine/src/Http/Http.php | 56 +++ vendor/hyperf/engine/src/Http/RawResponse.php | 45 +++ vendor/hyperf/engine/src/Http/Server.php | 77 ++++ .../hyperf/engine/src/Http/ServerFactory.php | 31 ++ vendor/hyperf/engine/src/Http/Stream.php | 237 ++++++++++++ vendor/hyperf/engine/src/Http/V2/Client.php | 104 ++++++ .../engine/src/Http/V2/ClientFactory.php | 23 ++ vendor/hyperf/engine/src/Http/V2/Request.php | 72 ++++ vendor/hyperf/engine/src/Http/V2/Response.php | 42 +++ .../engine/src/Http/WritableConnection.php | 41 +++ vendor/hyperf/engine/src/ResponseEmitter.php | 95 +++++ vendor/hyperf/engine/src/SafeSocket.php | 133 +++++++ vendor/hyperf/engine/src/Signal.php | 24 ++ vendor/hyperf/engine/src/Socket.php | 19 + .../engine/src/Socket/SocketFactory.php | 42 +++ .../hyperf/engine/src/Socket/SocketOption.php | 42 +++ vendor/hyperf/engine/src/WebSocket/Frame.php | 214 +++++++++++ vendor/hyperf/engine/src/WebSocket/Opcode.php | 28 ++ .../hyperf/engine/src/WebSocket/Response.php | 82 +++++ .../hyperf/engine/src/WebSocket/WebSocket.php | 81 ++++ vendor/hyperf/pimple/.gitattributes | 2 + vendor/hyperf/pimple/.gitignore | 4 + vendor/hyperf/pimple/.php-cs-fixer.php | 97 +++++ vendor/hyperf/pimple/.phpstorm.meta.php | 6 + vendor/hyperf/pimple/.travis.yml | 42 +++ vendor/hyperf/pimple/README.md | 195 ++++++++++ vendor/hyperf/pimple/composer.json | 54 +++ vendor/hyperf/pimple/phpunit.xml | 15 + vendor/hyperf/pimple/src/ConfigProvider.php | 32 ++ vendor/hyperf/pimple/src/Container.php | 133 +++++++ vendor/hyperf/pimple/src/ContainerFactory.php | 34 ++ .../Exception/InvalidDefinitionException.php | 19 + .../src/Exception/NotFoundException.php | 19 + .../src/Exception/NotSupportException.php | 19 + .../hyperf/pimple/src/ProviderInterface.php | 19 + 150 files changed, 6184 insertions(+), 14 deletions(-) create mode 100644 vendor/hyperf/context/.gitattributes create mode 100644 vendor/hyperf/context/LICENSE create mode 100644 vendor/hyperf/context/composer.json create mode 100644 vendor/hyperf/context/src/ApplicationContext.php create mode 100644 vendor/hyperf/context/src/Context.php create mode 100644 vendor/hyperf/context/src/Traits/CoroutineProxy.php create mode 100644 vendor/hyperf/contract/.gitattributes create mode 100644 vendor/hyperf/contract/LICENSE create mode 100644 vendor/hyperf/contract/composer.json create mode 100644 vendor/hyperf/contract/src/ApplicationInterface.php create mode 100644 vendor/hyperf/contract/src/Arrayable.php create mode 100644 vendor/hyperf/contract/src/Castable.php create mode 100644 vendor/hyperf/contract/src/CastsAttributes.php create mode 100644 vendor/hyperf/contract/src/CastsInboundAttributes.php create mode 100644 vendor/hyperf/contract/src/CompressInterface.php create mode 100644 vendor/hyperf/contract/src/ConfigInterface.php create mode 100644 vendor/hyperf/contract/src/ConnectionInterface.php create mode 100644 vendor/hyperf/contract/src/ContainerInterface.php create mode 100644 vendor/hyperf/contract/src/DispatcherInterface.php create mode 100644 vendor/hyperf/contract/src/FrequencyInterface.php create mode 100644 vendor/hyperf/contract/src/IPReaderInterface.php create mode 100644 vendor/hyperf/contract/src/IdGeneratorInterface.php create mode 100644 vendor/hyperf/contract/src/JsonDeSerializable.php create mode 100644 vendor/hyperf/contract/src/Jsonable.php create mode 100644 vendor/hyperf/contract/src/LengthAwarePaginatorInterface.php create mode 100644 vendor/hyperf/contract/src/MessageBag.php create mode 100644 vendor/hyperf/contract/src/MessageProvider.php create mode 100644 vendor/hyperf/contract/src/MiddlewareInitializerInterface.php create mode 100644 vendor/hyperf/contract/src/NormalizerInterface.php create mode 100644 vendor/hyperf/contract/src/OnCloseInterface.php create mode 100644 vendor/hyperf/contract/src/OnHandShakeInterface.php create mode 100644 vendor/hyperf/contract/src/OnMessageInterface.php create mode 100644 vendor/hyperf/contract/src/OnOpenInterface.php create mode 100644 vendor/hyperf/contract/src/OnPacketInterface.php create mode 100644 vendor/hyperf/contract/src/OnReceiveInterface.php create mode 100644 vendor/hyperf/contract/src/OnRequestInterface.php create mode 100644 vendor/hyperf/contract/src/PackerInterface.php create mode 100644 vendor/hyperf/contract/src/PaginatorInterface.php create mode 100644 vendor/hyperf/contract/src/PoolInterface.php create mode 100644 vendor/hyperf/contract/src/PoolOptionInterface.php create mode 100644 vendor/hyperf/contract/src/ProcessInterface.php create mode 100644 vendor/hyperf/contract/src/ResponseEmitterInterface.php create mode 100644 vendor/hyperf/contract/src/SessionInterface.php create mode 100644 vendor/hyperf/contract/src/StdoutLoggerInterface.php create mode 100644 vendor/hyperf/contract/src/Synchronized.php create mode 100644 vendor/hyperf/contract/src/TranslatorInterface.php create mode 100644 vendor/hyperf/contract/src/TranslatorLoaderInterface.php create mode 100644 vendor/hyperf/contract/src/UnCompressInterface.php create mode 100644 vendor/hyperf/contract/src/ValidatorInterface.php create mode 100644 vendor/hyperf/contract/src/Xmlable.php create mode 100644 vendor/hyperf/engine-contract/.gitattributes create mode 100644 vendor/hyperf/engine-contract/.gitignore create mode 100644 vendor/hyperf/engine-contract/.php-cs-fixer.php create mode 100644 vendor/hyperf/engine-contract/.phpstorm.meta.php create mode 100644 vendor/hyperf/engine-contract/LICENSE create mode 100644 vendor/hyperf/engine-contract/README.md create mode 100644 vendor/hyperf/engine-contract/composer.json create mode 100644 vendor/hyperf/engine-contract/phpunit.xml create mode 100644 vendor/hyperf/engine-contract/src/BarrierInterface.php create mode 100644 vendor/hyperf/engine-contract/src/ChannelInterface.php create mode 100644 vendor/hyperf/engine-contract/src/CoroutineInterface.php create mode 100644 vendor/hyperf/engine-contract/src/DefaultOptionInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/ClientInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/Http.php create mode 100644 vendor/hyperf/engine-contract/src/Http/RawResponseInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/ServerFactoryInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/ServerInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/V2/ClientFactoryInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/V2/ClientInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/V2/RequestInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/V2/ResponseInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Http/Writable.php create mode 100644 vendor/hyperf/engine-contract/src/ResponseEmitterInterface.php create mode 100644 vendor/hyperf/engine-contract/src/SignalInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Socket/SocketFactoryInterface.php create mode 100644 vendor/hyperf/engine-contract/src/Socket/SocketOptionInterface.php create mode 100644 vendor/hyperf/engine-contract/src/SocketInterface.php create mode 100644 vendor/hyperf/engine-contract/src/WebSocket/FrameInterface.php create mode 100644 vendor/hyperf/engine-contract/src/WebSocket/ResponseInterface.php create mode 100644 vendor/hyperf/engine-contract/src/WebSocket/WebSocketInterface.php create mode 100644 vendor/hyperf/engine/.gitattributes create mode 100644 vendor/hyperf/engine/.gitignore create mode 100644 vendor/hyperf/engine/.php-cs-fixer.php create mode 100644 vendor/hyperf/engine/.phpstorm.meta.php create mode 100644 vendor/hyperf/engine/Dockerfile create mode 100644 vendor/hyperf/engine/README.md create mode 100644 vendor/hyperf/engine/composer.json create mode 100644 vendor/hyperf/engine/phpunit.xml create mode 100644 vendor/hyperf/engine/src/Barrier.php create mode 100644 vendor/hyperf/engine/src/Channel.php create mode 100644 vendor/hyperf/engine/src/ConfigProvider.php create mode 100644 vendor/hyperf/engine/src/Constant.php create mode 100644 vendor/hyperf/engine/src/Constant/SocketType.php create mode 100644 vendor/hyperf/engine/src/Coroutine.php create mode 100644 vendor/hyperf/engine/src/DefaultOption.php create mode 100644 vendor/hyperf/engine/src/Exception/CoroutineDestroyedException.php create mode 100644 vendor/hyperf/engine/src/Exception/HttpClientException.php create mode 100644 vendor/hyperf/engine/src/Exception/InvalidArgumentException.php create mode 100644 vendor/hyperf/engine/src/Exception/RunningInNonCoroutineException.php create mode 100644 vendor/hyperf/engine/src/Exception/RuntimeException.php create mode 100644 vendor/hyperf/engine/src/Exception/SocketClosedException.php create mode 100644 vendor/hyperf/engine/src/Exception/SocketConnectException.php create mode 100644 vendor/hyperf/engine/src/Exception/SocketTimeoutException.php create mode 100644 vendor/hyperf/engine/src/Extension.php create mode 100644 vendor/hyperf/engine/src/Functions.php create mode 100644 vendor/hyperf/engine/src/Http/Client.php create mode 100644 vendor/hyperf/engine/src/Http/EventStream.php create mode 100644 vendor/hyperf/engine/src/Http/FdGetter.php create mode 100644 vendor/hyperf/engine/src/Http/Http.php create mode 100644 vendor/hyperf/engine/src/Http/RawResponse.php create mode 100644 vendor/hyperf/engine/src/Http/Server.php create mode 100644 vendor/hyperf/engine/src/Http/ServerFactory.php create mode 100755 vendor/hyperf/engine/src/Http/Stream.php create mode 100644 vendor/hyperf/engine/src/Http/V2/Client.php create mode 100644 vendor/hyperf/engine/src/Http/V2/ClientFactory.php create mode 100644 vendor/hyperf/engine/src/Http/V2/Request.php create mode 100644 vendor/hyperf/engine/src/Http/V2/Response.php create mode 100644 vendor/hyperf/engine/src/Http/WritableConnection.php create mode 100644 vendor/hyperf/engine/src/ResponseEmitter.php create mode 100644 vendor/hyperf/engine/src/SafeSocket.php create mode 100644 vendor/hyperf/engine/src/Signal.php create mode 100644 vendor/hyperf/engine/src/Socket.php create mode 100644 vendor/hyperf/engine/src/Socket/SocketFactory.php create mode 100644 vendor/hyperf/engine/src/Socket/SocketOption.php create mode 100644 vendor/hyperf/engine/src/WebSocket/Frame.php create mode 100644 vendor/hyperf/engine/src/WebSocket/Opcode.php create mode 100644 vendor/hyperf/engine/src/WebSocket/Response.php create mode 100644 vendor/hyperf/engine/src/WebSocket/WebSocket.php create mode 100644 vendor/hyperf/pimple/.gitattributes create mode 100644 vendor/hyperf/pimple/.gitignore create mode 100644 vendor/hyperf/pimple/.php-cs-fixer.php create mode 100644 vendor/hyperf/pimple/.phpstorm.meta.php create mode 100644 vendor/hyperf/pimple/.travis.yml create mode 100644 vendor/hyperf/pimple/README.md create mode 100644 vendor/hyperf/pimple/composer.json create mode 100644 vendor/hyperf/pimple/phpunit.xml create mode 100644 vendor/hyperf/pimple/src/ConfigProvider.php create mode 100644 vendor/hyperf/pimple/src/Container.php create mode 100644 vendor/hyperf/pimple/src/ContainerFactory.php create mode 100644 vendor/hyperf/pimple/src/Exception/InvalidDefinitionException.php create mode 100644 vendor/hyperf/pimple/src/Exception/NotFoundException.php create mode 100644 vendor/hyperf/pimple/src/Exception/NotSupportException.php create mode 100644 vendor/hyperf/pimple/src/ProviderInterface.php diff --git a/composer.json b/composer.json index 28eccb9..ffea8af 100755 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "ext-pdo": "*", "ext-bcmath": "*", "phpseclib/phpseclib": "*", - "workerman/phpsocket.io": "^2.2" + "workerman/phpsocket.io": "^2.2", + "hyperf/pimple": "^2.2" }, "config": { "preferred-install": "dist", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 31e2d6a..efb3ba2 100755 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -32,7 +32,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '0a95974a63e41cca15747597241a53381c61f1df', + 'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6', 'name' => 'fastadminnet/fastadmin', ), 'versions' => @@ -71,7 +71,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '0a95974a63e41cca15747597241a53381c61f1df', + 'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6', ), 'fastadminnet/fastadmin-addons' => array ( @@ -118,6 +118,51 @@ private static $installed = array ( ), 'reference' => '21dc724a0583619cd1652f673303492272778051', ), + 'hyperf/context' => + array ( + 'pretty_version' => 'v3.0.37', + 'version' => '3.0.37.0', + 'aliases' => + array ( + ), + 'reference' => '264e06fb882426d90758eca2c5bb8293f8b60455', + ), + 'hyperf/contract' => + array ( + 'pretty_version' => 'v3.0.37', + 'version' => '3.0.37.0', + 'aliases' => + array ( + ), + 'reference' => '2e8290104468a8d90855067d8644a32114474452', + ), + 'hyperf/engine' => + array ( + 'pretty_version' => 'v2.14.1', + 'version' => '2.14.1.0', + 'aliases' => + array ( + ), + 'reference' => '6595d2659ce7ebb940b8740a00ecd199128398f0', + ), + 'hyperf/engine-contract' => + array ( + 'pretty_version' => 'v1.13.0', + 'version' => '1.13.0.0', + 'aliases' => + array ( + ), + 'reference' => '26a18ec0375147546bf9702b0fd737fdd2cec1d6', + ), + 'hyperf/pimple' => + array ( + 'pretty_version' => 'v2.2.2', + 'version' => '2.2.2.0', + 'aliases' => + array ( + ), + 'reference' => '7bd07745c256b83679471c06ec2a11e901d37277', + ), 'maennchen/zipstream-php' => array ( 'pretty_version' => '2.4.0', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index e42813a..8c3bdac 100755 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -12,15 +12,16 @@ return array( '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + '9c7a683baffd24f5595c1dc5f5273030' => $vendorDir . '/hyperf/engine/src/Functions.php', '6b998e7ad3182c0d21d23780badfa07b' => $vendorDir . '/yansongda/supports/src/Functions.php', '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', '988d02680beedec88d52f2787b2d2007' => $vendorDir . '/yansongda/artful/src/Functions.php', + 'f7e3d8cd19cf23ce3883a6a51d791b77' => $vendorDir . '/fastadminnet/fastadmin-addons/src/common.php', 'f0e7e63bbb278a92db02393536748c5f' => $vendorDir . '/overtrue/wechat/src/Kernel/Support/Helpers.php', '6747f579ad6817f318cc3a7e7a0abb93' => $vendorDir . '/overtrue/wechat/src/Kernel/Helpers.php', 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', 'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php', - 'f7e3d8cd19cf23ce3883a6a51d791b77' => $vendorDir . '/fastadminnet/fastadmin-addons/src/common.php', '8c783b3a3de2f6d9177022b5ccdcc841' => $vendorDir . '/yansongda/pay/src/Functions.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index a0ea073..6b5b4a4 100755 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -9,7 +9,7 @@ return array( 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), - 'think\\' => array($baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src', $vendorDir . '/fastadminnet/fastadmin-addons/src'), + 'think\\' => array($vendorDir . '/fastadminnet/fastadmin-addons/src', $baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'), 'phpseclib3\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'addons\\' => array($baseDir . '/addons'), 'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'), @@ -32,7 +32,7 @@ return array( 'Symfony\\Bridge\\PsrHttpMessage\\' => array($vendorDir . '/symfony/psr-http-message-bridge'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), @@ -46,6 +46,11 @@ return array( 'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'), + 'Hyperf\\Pimple\\' => array($vendorDir . '/hyperf/pimple/src'), + 'Hyperf\\Engine\\Contract\\' => array($vendorDir . '/hyperf/engine-contract/src'), + 'Hyperf\\Engine\\' => array($vendorDir . '/hyperf/engine/src'), + 'Hyperf\\Contract\\' => array($vendorDir . '/hyperf/contract/src'), + 'Hyperf\\Context\\' => array($vendorDir . '/hyperf/context/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index f85c602..8875d90 100755 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -13,16 +13,17 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1 '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + '9c7a683baffd24f5595c1dc5f5273030' => __DIR__ . '/..' . '/hyperf/engine/src/Functions.php', '6b998e7ad3182c0d21d23780badfa07b' => __DIR__ . '/..' . '/yansongda/supports/src/Functions.php', '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '988d02680beedec88d52f2787b2d2007' => __DIR__ . '/..' . '/yansongda/artful/src/Functions.php', + 'f7e3d8cd19cf23ce3883a6a51d791b77' => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src/common.php', 'f0e7e63bbb278a92db02393536748c5f' => __DIR__ . '/..' . '/overtrue/wechat/src/Kernel/Support/Helpers.php', '6747f579ad6817f318cc3a7e7a0abb93' => __DIR__ . '/..' . '/overtrue/wechat/src/Kernel/Helpers.php', 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', 'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php', - 'f7e3d8cd19cf23ce3883a6a51d791b77' => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src/common.php', '8c783b3a3de2f6d9177022b5ccdcc841' => __DIR__ . '/..' . '/yansongda/pay/src/Functions.php', ); @@ -100,6 +101,14 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1 'Monolog\\' => 8, 'Matrix\\' => 7, ), + 'H' => + array ( + 'Hyperf\\Pimple\\' => 14, + 'Hyperf\\Engine\\Contract\\' => 23, + 'Hyperf\\Engine\\' => 14, + 'Hyperf\\Contract\\' => 16, + 'Hyperf\\Context\\' => 15, + ), 'G' => array ( 'GuzzleHttp\\Psr7\\' => 16, @@ -134,9 +143,9 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1 ), 'think\\' => array ( - 0 => __DIR__ . '/../..' . '/thinkphp/library/think', - 1 => __DIR__ . '/..' . '/topthink/think-queue/src', - 2 => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src', + 0 => __DIR__ . '/..' . '/fastadminnet/fastadmin-addons/src', + 1 => __DIR__ . '/../..' . '/thinkphp/library/think', + 2 => __DIR__ . '/..' . '/topthink/think-queue/src', ), 'phpseclib3\\' => array ( @@ -228,8 +237,8 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1 ), 'Psr\\Http\\Message\\' => array ( - 0 => __DIR__ . '/..' . '/psr/http-message/src', - 1 => __DIR__ . '/..' . '/psr/http-factory/src', + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', ), 'Psr\\Http\\Client\\' => array ( @@ -283,6 +292,26 @@ class ComposerStaticInitf3106b6ef3260b6914241eab0bed11c1 array ( 0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src', ), + 'Hyperf\\Pimple\\' => + array ( + 0 => __DIR__ . '/..' . '/hyperf/pimple/src', + ), + 'Hyperf\\Engine\\Contract\\' => + array ( + 0 => __DIR__ . '/..' . '/hyperf/engine-contract/src', + ), + 'Hyperf\\Engine\\' => + array ( + 0 => __DIR__ . '/..' . '/hyperf/engine/src', + ), + 'Hyperf\\Contract\\' => + array ( + 0 => __DIR__ . '/..' . '/hyperf/contract/src', + ), + 'Hyperf\\Context\\' => + array ( + 0 => __DIR__ . '/..' . '/hyperf/context/src', + ), 'GuzzleHttp\\Psr7\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 8c3897f..7de3cb3 100755 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -658,6 +658,352 @@ ], "install-path": "../guzzlehttp/psr7" }, + { + "name": "hyperf/context", + "version": "v3.0.37", + "version_normalized": "3.0.37.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/context.git", + "reference": "264e06fb882426d90758eca2c5bb8293f8b60455" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hyperf/context/zipball/264e06fb882426d90758eca2c5bb8293f8b60455", + "reference": "264e06fb882426d90758eca2c5bb8293f8b60455", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "hyperf/engine": "^1.2|^2.0", + "php": ">=8.0" + }, + "time": "2023-09-19T01:50:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Hyperf\\Context\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A coroutine/application context library.", + "homepage": "https://hyperf.io", + "keywords": [ + "Context", + "hyperf", + "php", + "swoole" + ], + "support": { + "docs": "https://hyperf.wiki", + "issues": "https://github.com/hyperf/hyperf/issues", + "pull-request": "https://github.com/hyperf/hyperf/pulls", + "source": "https://github.com/hyperf/hyperf" + }, + "install-path": "../hyperf/context" + }, + { + "name": "hyperf/contract", + "version": "v3.0.37", + "version_normalized": "3.0.37.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/contract.git", + "reference": "2e8290104468a8d90855067d8644a32114474452" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hyperf/contract/zipball/2e8290104468a8d90855067d8644a32114474452", + "reference": "2e8290104468a8d90855067d8644a32114474452", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=8.0" + }, + "time": "2023-09-19T01:50:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Hyperf\\Contract\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The contracts of Hyperf.", + "homepage": "https://hyperf.io", + "keywords": [ + "hyperf", + "php", + "swoole" + ], + "support": { + "docs": "https://hyperf.wiki", + "issues": "https://github.com/hyperf/hyperf/issues", + "pull-request": "https://github.com/hyperf/hyperf/pulls", + "source": "https://github.com/hyperf/hyperf" + }, + "install-path": "../hyperf/contract" + }, + { + "name": "hyperf/engine", + "version": "v2.14.1", + "version_normalized": "2.14.1.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/engine.git", + "reference": "6595d2659ce7ebb940b8740a00ecd199128398f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hyperf/engine/zipball/6595d2659ce7ebb940b8740a00ecd199128398f0", + "reference": "6595d2659ce7ebb940b8740a00ecd199128398f0", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "hyperf/engine-contract": "~1.13.0", + "php": ">=8.0" + }, + "conflict": { + "ext-swoole": "<5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "hyperf/guzzle": "^3.0", + "hyperf/http-message": "^3.0", + "mockery/mockery": "^1.5", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": "^9.4", + "swoole/ide-helper": "5.*" + }, + "suggest": { + "ext-sockets": "*", + "ext-swoole": ">=5.0", + "hyperf/http-message": "Required to use ResponseEmitter.", + "psr/http-message": "Required to use WebSocket Frame." + }, + "time": "2025-08-04T02:12:07+00:00", + "type": "library", + "extra": { + "hyperf": { + "config": "Hyperf\\Engine\\ConfigProvider" + }, + "branch-alias": { + "dev-master": "2.14-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Functions.php" + ], + "psr-4": { + "Hyperf\\Engine\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Coroutine engine provided by swoole.", + "keywords": [ + "engine", + "hyperf", + "php", + "swoole" + ], + "support": { + "issues": "https://github.com/hyperf/engine/issues", + "source": "https://github.com/hyperf/engine/tree/v2.14.1" + }, + "funding": [ + { + "url": "https://hyperf.wiki/#/zh-cn/donate", + "type": "custom" + }, + { + "url": "https://opencollective.com/hyperf", + "type": "open_collective" + } + ], + "install-path": "../hyperf/engine" + }, + { + "name": "hyperf/engine-contract", + "version": "v1.13.0", + "version_normalized": "1.13.0.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf/engine-contract.git", + "reference": "26a18ec0375147546bf9702b0fd737fdd2cec1d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hyperf/engine-contract/zipball/26a18ec0375147546bf9702b0fd737fdd2cec1d6", + "reference": "26a18ec0375147546bf9702b0fd737fdd2cec1d6", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "mockery/mockery": "^1.0", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": ">=7.0", + "psr/http-message": "^1.0", + "swoole/ide-helper": "^4.5" + }, + "suggest": { + "psr/http-message": "Required to use WebSocket Frame." + }, + "time": "2025-04-13T14:48:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Hyperf\\Engine\\Contract\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Contract for Coroutine Engine", + "keywords": [ + "contract", + "coroutine", + "engine", + "hyperf", + "php" + ], + "support": { + "issues": "https://github.com/hyperf/engine-contract/issues", + "source": "https://github.com/hyperf/engine-contract/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://hyperf.wiki/#/zh-cn/donate", + "type": "custom" + }, + { + "url": "https://opencollective.com/hyperf", + "type": "open_collective" + } + ], + "install-path": "../hyperf/engine-contract" + }, + { + "name": "hyperf/pimple", + "version": "v2.2.2", + "version_normalized": "2.2.2.0", + "source": { + "type": "git", + "url": "https://github.com/hyperf-cloud/pimple-integration.git", + "reference": "7bd07745c256b83679471c06ec2a11e901d37277" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hyperf-cloud/pimple-integration/zipball/7bd07745c256b83679471c06ec2a11e901d37277", + "reference": "7bd07745c256b83679471c06ec2a11e901d37277", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "hyperf/context": "^3.0", + "hyperf/contract": "^3.0", + "php": ">=8.0", + "pimple/pimple": "^3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "hyperf/support": "^3.0", + "mockery/mockery": "^1.3", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": ">=7.0" + }, + "time": "2023-06-10T04:41:29+00:00", + "type": "library", + "extra": { + "hyperf": { + "config": "Hyperf\\Pimple\\ConfigProvider" + }, + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Hyperf\\Pimple\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Pimple Container", + "keywords": [ + "container", + "hyperf", + "php", + "psr11" + ], + "support": { + "issues": "https://github.com/hyperf-cloud/pimple-integration/issues", + "source": "https://github.com/hyperf-cloud/pimple-integration/tree/v2.2.2" + }, + "install-path": "../hyperf/pimple" + }, { "name": "maennchen/zipstream-php", "version": "2.4.0", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 315418a..1d01c53 100755 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => '0a95974a63e41cca15747597241a53381c61f1df', + 'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6', 'name' => 'fastadminnet/fastadmin', ), 'versions' => @@ -45,7 +45,7 @@ 'aliases' => array ( ), - 'reference' => '0a95974a63e41cca15747597241a53381c61f1df', + 'reference' => 'be05b7f6639c030982107e2c8b858af2b106b2b6', ), 'fastadminnet/fastadmin-addons' => array ( @@ -92,6 +92,51 @@ ), 'reference' => '21dc724a0583619cd1652f673303492272778051', ), + 'hyperf/context' => + array ( + 'pretty_version' => 'v3.0.37', + 'version' => '3.0.37.0', + 'aliases' => + array ( + ), + 'reference' => '264e06fb882426d90758eca2c5bb8293f8b60455', + ), + 'hyperf/contract' => + array ( + 'pretty_version' => 'v3.0.37', + 'version' => '3.0.37.0', + 'aliases' => + array ( + ), + 'reference' => '2e8290104468a8d90855067d8644a32114474452', + ), + 'hyperf/engine' => + array ( + 'pretty_version' => 'v2.14.1', + 'version' => '2.14.1.0', + 'aliases' => + array ( + ), + 'reference' => '6595d2659ce7ebb940b8740a00ecd199128398f0', + ), + 'hyperf/engine-contract' => + array ( + 'pretty_version' => 'v1.13.0', + 'version' => '1.13.0.0', + 'aliases' => + array ( + ), + 'reference' => '26a18ec0375147546bf9702b0fd737fdd2cec1d6', + ), + 'hyperf/pimple' => + array ( + 'pretty_version' => 'v2.2.2', + 'version' => '2.2.2.0', + 'aliases' => + array ( + ), + 'reference' => '7bd07745c256b83679471c06ec2a11e901d37277', + ), 'maennchen/zipstream-php' => array ( 'pretty_version' => '2.4.0', diff --git a/vendor/hyperf/context/.gitattributes b/vendor/hyperf/context/.gitattributes new file mode 100644 index 0000000..27b765f --- /dev/null +++ b/vendor/hyperf/context/.gitattributes @@ -0,0 +1,2 @@ +/tests export-ignore +/.github export-ignore diff --git a/vendor/hyperf/context/LICENSE b/vendor/hyperf/context/LICENSE new file mode 100644 index 0000000..c35d3f5 --- /dev/null +++ b/vendor/hyperf/context/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Hyperf + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/hyperf/context/composer.json b/vendor/hyperf/context/composer.json new file mode 100644 index 0000000..b7862f0 --- /dev/null +++ b/vendor/hyperf/context/composer.json @@ -0,0 +1,40 @@ +{ + "name": "hyperf/context", + "description": "A coroutine/application context library.", + "license": "MIT", + "keywords": [ + "php", + "swoole", + "hyperf", + "context" + ], + "homepage": "https://hyperf.io", + "support": { + "docs": "https://hyperf.wiki", + "issues": "https://github.com/hyperf/hyperf/issues", + "pull-request": "https://github.com/hyperf/hyperf/pulls", + "source": "https://github.com/hyperf/hyperf" + }, + "require": { + "php": ">=8.0", + "hyperf/engine": "^1.2|^2.0" + }, + "autoload": { + "psr-4": { + "Hyperf\\Context\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "HyperfTest\\Context\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/vendor/hyperf/context/src/ApplicationContext.php b/vendor/hyperf/context/src/ApplicationContext.php new file mode 100644 index 0000000..8b53af7 --- /dev/null +++ b/vendor/hyperf/context/src/ApplicationContext.php @@ -0,0 +1,39 @@ + 0) { + Coroutine::getContextFor($coroutineId)[$id] = $value; + } else { + static::$nonCoContext[$id] = $value; + } + + return $value; + } + + public static function get(string $id, mixed $default = null, ?int $coroutineId = null): mixed + { + if (Coroutine::id() > 0) { + return Coroutine::getContextFor($coroutineId)[$id] ?? $default; + } + + return static::$nonCoContext[$id] ?? $default; + } + + public static function has(string $id, ?int $coroutineId = null): bool + { + if (Coroutine::id() > 0) { + return isset(Coroutine::getContextFor($coroutineId)[$id]); + } + + return isset(static::$nonCoContext[$id]); + } + + /** + * Release the context when you are not in coroutine environment. + */ + public static function destroy(string $id, ?int $coroutineId = null): void + { + if (Coroutine::id() > 0) { + unset(Coroutine::getContextFor($coroutineId)[$id]); + } + + unset(static::$nonCoContext[$id]); + } + + /** + * Copy the context from a coroutine to current coroutine. + * This method will delete the origin values in current coroutine. + */ + public static function copy(int $fromCoroutineId, array $keys = []): void + { + $from = Coroutine::getContextFor($fromCoroutineId); + + if ($from === null) { + return; + } + + $current = Coroutine::getContextFor(); + + if ($keys) { + $map = array_intersect_key($from->getArrayCopy(), array_flip($keys)); + } else { + $map = $from->getArrayCopy(); + } + + $current->exchangeArray($map); + } + + /** + * Retrieve the value and override it by closure. + */ + public static function override(string $id, Closure $closure, ?int $coroutineId = null): mixed + { + $value = null; + + if (self::has($id, $coroutineId)) { + $value = self::get($id, null, $coroutineId); + } + + $value = $closure($value); + + self::set($id, $value, $coroutineId); + + return $value; + } + + /** + * Retrieve the value and store it if not exists. + */ + public static function getOrSet(string $id, mixed $value, ?int $coroutineId = null): mixed + { + if (! self::has($id, $coroutineId)) { + return self::set($id, value($value), $coroutineId); + } + + return self::get($id, null, $coroutineId); + } + + public static function getContainer(?int $coroutineId = null) + { + if (Coroutine::id() > 0) { + return Coroutine::getContextFor($coroutineId); + } + + return static::$nonCoContext; + } +} diff --git a/vendor/hyperf/context/src/Traits/CoroutineProxy.php b/vendor/hyperf/context/src/Traits/CoroutineProxy.php new file mode 100644 index 0000000..abeb265 --- /dev/null +++ b/vendor/hyperf/context/src/Traits/CoroutineProxy.php @@ -0,0 +1,44 @@ +getTargetObject(); + return $target->{$name}(...$arguments); + } + + public function __get($name) + { + $target = $this->getTargetObject(); + return $target->{$name}; + } + + public function __set($name, $value) + { + $target = $this->getTargetObject(); + return $target->{$name} = $value; + } + + protected function getTargetObject() + { + if (! isset($this->proxyKey)) { + throw new RuntimeException(sprintf('Missing $proxyKey property in %s.', $this::class)); + } + return Context::get($this->proxyKey); + } +} diff --git a/vendor/hyperf/contract/.gitattributes b/vendor/hyperf/contract/.gitattributes new file mode 100644 index 0000000..27b765f --- /dev/null +++ b/vendor/hyperf/contract/.gitattributes @@ -0,0 +1,2 @@ +/tests export-ignore +/.github export-ignore diff --git a/vendor/hyperf/contract/LICENSE b/vendor/hyperf/contract/LICENSE new file mode 100644 index 0000000..c35d3f5 --- /dev/null +++ b/vendor/hyperf/contract/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Hyperf + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/hyperf/contract/composer.json b/vendor/hyperf/contract/composer.json new file mode 100644 index 0000000..c2d5786 --- /dev/null +++ b/vendor/hyperf/contract/composer.json @@ -0,0 +1,33 @@ +{ + "name": "hyperf/contract", + "description": "The contracts of Hyperf.", + "license": "MIT", + "keywords": [ + "php", + "swoole", + "hyperf" + ], + "homepage": "https://hyperf.io", + "support": { + "docs": "https://hyperf.wiki", + "issues": "https://github.com/hyperf/hyperf/issues", + "pull-request": "https://github.com/hyperf/hyperf/pulls", + "source": "https://github.com/hyperf/hyperf" + }, + "require": { + "php": ">=8.0" + }, + "autoload": { + "psr-4": { + "Hyperf\\Contract\\": "src/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/vendor/hyperf/contract/src/ApplicationInterface.php b/vendor/hyperf/contract/src/ApplicationInterface.php new file mode 100644 index 0000000..95b66fb --- /dev/null +++ b/vendor/hyperf/contract/src/ApplicationInterface.php @@ -0,0 +1,21 @@ + + */ + public function toArray(): array; +} diff --git a/vendor/hyperf/contract/src/Castable.php b/vendor/hyperf/contract/src/Castable.php new file mode 100644 index 0000000..83eef90 --- /dev/null +++ b/vendor/hyperf/contract/src/Castable.php @@ -0,0 +1,22 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + '@DoctrineAnnotation' => true, + '@PhpCsFixer' => true, + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => $header, + 'separate' => 'none', + 'location' => 'after_declare_strict', + ], + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'list_syntax' => [ + 'syntax' => 'short', + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + 'blank_line_before_statement' => [ + 'statements' => [ + 'declare', + ], + ], + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author', + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', 'function', 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'single_line_comment_style' => [ + 'comment_types' => [ + ], + ], + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + ], + 'phpdoc_align' => [ + 'align' => 'left', + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'constant_case' => [ + 'case' => 'lower', + ], + 'global_namespace_import' => [ + 'import_classes' => true, + 'import_constants' => true, + 'import_functions' => true, + ], + 'class_attributes_separation' => true, + 'combine_consecutive_unsets' => true, + 'declare_strict_types' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_static_reference' => true, + 'no_useless_else' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'not_operator_with_space' => false, + 'ordered_class_elements' => true, + 'php_unit_strict' => false, + 'phpdoc_separation' => false, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'multiline_comment_opening_closing' => true, + 'single_line_empty_body' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('vendor') + ->in(__DIR__) + ) + ->setUsingCache(false); diff --git a/vendor/hyperf/engine-contract/.phpstorm.meta.php b/vendor/hyperf/engine-contract/.phpstorm.meta.php new file mode 100644 index 0000000..1014069 --- /dev/null +++ b/vendor/hyperf/engine-contract/.phpstorm.meta.php @@ -0,0 +1,6 @@ +=8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "mockery/mockery": "^1.0", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": ">=7.0", + "psr/http-message": "^1.0", + "swoole/ide-helper": "^4.5" + }, + "suggest": { + "psr/http-message": "Required to use WebSocket Frame." + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "scripts": { + "test": "phpunit -c phpunit.xml --colors=always", + "analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src", + "cs-fix": "php-cs-fixer fix $1" + } +} diff --git a/vendor/hyperf/engine-contract/phpunit.xml b/vendor/hyperf/engine-contract/phpunit.xml new file mode 100644 index 0000000..16b9c39 --- /dev/null +++ b/vendor/hyperf/engine-contract/phpunit.xml @@ -0,0 +1,15 @@ + + + + ./tests/ + + diff --git a/vendor/hyperf/engine-contract/src/BarrierInterface.php b/vendor/hyperf/engine-contract/src/BarrierInterface.php new file mode 100644 index 0000000..2afdbbf --- /dev/null +++ b/vendor/hyperf/engine-contract/src/BarrierInterface.php @@ -0,0 +1,28 @@ + returns all coroutine IDs + */ + public static function list(): iterable; +} diff --git a/vendor/hyperf/engine-contract/src/DefaultOptionInterface.php b/vendor/hyperf/engine-contract/src/DefaultOptionInterface.php new file mode 100644 index 0000000..ff6ae63 --- /dev/null +++ b/vendor/hyperf/engine-contract/src/DefaultOptionInterface.php @@ -0,0 +1,21 @@ + true, + * 'package_max_length' => 1024 * 1024 * 2, + * 'package_length_type' => 'N', + * 'package_length_offset' => 0, + * 'package_body_offset' => 4, + * ] + */ + public function getProtocol(): array; +} diff --git a/vendor/hyperf/engine-contract/src/SocketInterface.php b/vendor/hyperf/engine-contract/src/SocketInterface.php new file mode 100644 index 0000000..a934c2e --- /dev/null +++ b/vendor/hyperf/engine-contract/src/SocketInterface.php @@ -0,0 +1,24 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + '@DoctrineAnnotation' => true, + '@PhpCsFixer' => true, + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => $header, + 'separate' => 'none', + 'location' => 'after_declare_strict', + ], + 'array_syntax' => [ + 'syntax' => 'short' + ], + 'list_syntax' => [ + 'syntax' => 'short' + ], + 'concat_space' => [ + 'spacing' => 'one' + ], + 'blank_line_before_statement' => [ + 'statements' => [ + 'declare', + ], + ], + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author' + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', 'function', 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'single_line_comment_style' => [ + 'comment_types' => [ + ], + ], + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + ], + 'phpdoc_align' => [ + 'align' => 'left', + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'constant_case' => [ + 'case' => 'lower', + ], + 'global_namespace_import' => [ + 'import_classes' => true, + 'import_constants' => true, + 'import_functions' => true, + ], + 'class_attributes_separation' => true, + 'combine_consecutive_unsets' => true, + 'declare_strict_types' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_static_reference' => true, + 'no_useless_else' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'not_operator_with_space' => false, + 'ordered_class_elements' => true, + 'php_unit_strict' => false, + 'phpdoc_separation' => false, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'multiline_comment_opening_closing' => true, + 'single_line_empty_body' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('vendor') + ->in(__DIR__) + ) + ->setUsingCache(false); diff --git a/vendor/hyperf/engine/.phpstorm.meta.php b/vendor/hyperf/engine/.phpstorm.meta.php new file mode 100644 index 0000000..1014069 --- /dev/null +++ b/vendor/hyperf/engine/.phpstorm.meta.php @@ -0,0 +1,6 @@ +" version="1.0" license="MIT" app.name="Hyperf" + +ARG timezone +ARG PHP_VERSION + +ENV TIMEZONE=${timezone:-"Asia/Shanghai"} +ENV COMPOSER_ROOT_VERSION="v2.0.0" + +# update +RUN set -ex \ + # show php version and extensions + && php -v \ + && php -m \ + && php --ri swoole \ + # ---------- some config ---------- + && cd /etc/php* \ + # - config PHP + && { \ + echo "upload_max_filesize=128M"; \ + echo "post_max_size=128M"; \ + echo "memory_limit=1G"; \ + echo "date.timezone=${TIMEZONE}"; \ + } | tee conf.d/99_overrides.ini \ + # - config timezone + && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \ + && echo "${TIMEZONE}" > /etc/timezone \ + # ---------- clear works ---------- + && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \ + && echo -e "\033[42;37m Build Completed :).\033[0m\n" + +WORKDIR /opt/www + +COPY . /opt/www diff --git a/vendor/hyperf/engine/README.md b/vendor/hyperf/engine/README.md new file mode 100644 index 0000000..2104dd2 --- /dev/null +++ b/vendor/hyperf/engine/README.md @@ -0,0 +1,7 @@ +# Swoole Engine + +[![Swoole Engine Test](https://github.com/hyperf/engine/actions/workflows/test.yml/badge.svg)](https://github.com/hyperf/engine/actions/workflows/test.yml) + +``` +composer require hyperf/engine +``` diff --git a/vendor/hyperf/engine/composer.json b/vendor/hyperf/engine/composer.json new file mode 100644 index 0000000..bde1f15 --- /dev/null +++ b/vendor/hyperf/engine/composer.json @@ -0,0 +1,66 @@ +{ + "name": "hyperf/engine", + "type": "library", + "license": "MIT", + "keywords": [ + "php", + "hyperf", + "engine", + "swoole" + ], + "description": "Coroutine engine provided by swoole.", + "autoload": { + "psr-4": { + "Hyperf\\Engine\\": "src/" + }, + "files": [ + "src/Functions.php" + ] + }, + "autoload-dev": { + "psr-4": { + "HyperfTest\\": "tests" + } + }, + "require": { + "php": ">=8.0", + "hyperf/engine-contract": "~1.13.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "hyperf/guzzle": "^3.0", + "hyperf/http-message": "^3.0", + "mockery/mockery": "^1.5", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": "^9.4", + "swoole/ide-helper": "5.*" + }, + "suggest": { + "ext-sockets": "*", + "ext-swoole": ">=5.0", + "psr/http-message": "Required to use WebSocket Frame.", + "hyperf/http-message": "Required to use ResponseEmitter." + }, + "conflict": { + "ext-swoole": "<5.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "2.14-dev" + }, + "hyperf": { + "config": "Hyperf\\Engine\\ConfigProvider" + } + }, + "scripts": { + "test": "phpunit -c phpunit.xml --colors=always", + "analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src", + "cs-fix": "php-cs-fixer fix $1" + } +} diff --git a/vendor/hyperf/engine/phpunit.xml b/vendor/hyperf/engine/phpunit.xml new file mode 100644 index 0000000..d2c615a --- /dev/null +++ b/vendor/hyperf/engine/phpunit.xml @@ -0,0 +1,15 @@ + + + + ./tests/ + + \ No newline at end of file diff --git a/vendor/hyperf/engine/src/Barrier.php b/vendor/hyperf/engine/src/Barrier.php new file mode 100644 index 0000000..379db42 --- /dev/null +++ b/vendor/hyperf/engine/src/Barrier.php @@ -0,0 +1,29 @@ +capacity; + } + + public function getLength(): int + { + return $this->length(); + } + + public function isAvailable(): bool + { + return ! $this->isClosing(); + } + + public function close(): bool + { + $this->closed = true; + return parent::close(); + } + + public function hasProducers(): bool + { + throw new RuntimeException('Not supported.'); + } + + public function hasConsumers(): bool + { + throw new RuntimeException('Not supported.'); + } + + public function isReadable(): bool + { + throw new RuntimeException('Not supported.'); + } + + public function isWritable(): bool + { + throw new RuntimeException('Not supported.'); + } + + public function isClosing(): bool + { + return $this->closed || $this->errCode === SWOOLE_CHANNEL_CLOSED; + } + + public function isTimeout(): bool + { + return ! $this->closed && $this->errCode === SWOOLE_CHANNEL_TIMEOUT; + } +} diff --git a/vendor/hyperf/engine/src/ConfigProvider.php b/vendor/hyperf/engine/src/ConfigProvider.php new file mode 100644 index 0000000..9710ca1 --- /dev/null +++ b/vendor/hyperf/engine/src/ConfigProvider.php @@ -0,0 +1,28 @@ + [ + SocketFactoryInterface::class => SocketFactory::class, + ], + ]; + } +} diff --git a/vendor/hyperf/engine/src/Constant.php b/vendor/hyperf/engine/src/Constant.php new file mode 100644 index 0000000..8d56a83 --- /dev/null +++ b/vendor/hyperf/engine/src/Constant.php @@ -0,0 +1,26 @@ +callable = $callable; + } + + public static function create(callable $callable, ...$data): static + { + $coroutine = new static($callable); + $coroutine->execute(...$data); + return $coroutine; + } + + public function execute(...$data): static + { + $this->id = SwooleCo::create($this->callable, ...$data); + return $this; + } + + public function getId(): int + { + if (is_null($this->id)) { + throw new RuntimeException('Coroutine was not be executed.'); + } + return $this->id; + } + + public static function id(): int + { + return SwooleCo::getCid(); + } + + public static function pid(?int $id = null): int + { + if ($id) { + $cid = SwooleCo::getPcid($id); + if ($cid === false) { + throw new CoroutineDestroyedException(sprintf('Coroutine #%d has been destroyed.', $id)); + } + } else { + $cid = SwooleCo::getPcid(); + } + if ($cid === false) { + throw new RunningInNonCoroutineException('Non-Coroutine environment don\'t has parent coroutine id.'); + } + return max(0, $cid); + } + + public static function set(array $config): void + { + SwooleCo::set($config); + } + + public static function getContextFor(?int $id = null): ?ArrayObject + { + if ($id === null) { + return SwooleCo::getContext(); + } + + return SwooleCo::getContext($id); + } + + public static function defer(callable $callable): void + { + SwooleCo::defer($callable); + } + + /** + * Yield the current coroutine. + * @param mixed $data only Support Swow + * @return bool + */ + public static function yield(mixed $data = null): mixed + { + return SwooleCo::yield(); + } + + /** + * Resume the coroutine by coroutine Id. + * @param mixed $data only Support Swow + * @return bool + */ + public static function resumeById(int $id, mixed ...$data): mixed + { + return SwooleCo::resume($id); + } + + /** + * Get the coroutine stats. + */ + public static function stats(): array + { + return SwooleCo::stats(); + } + + public static function exists(?int $id = null): bool + { + return SwooleCo::exists($id); + } + + /** + * @return iterable + */ + public static function list(): iterable + { + foreach (SwooleCo::list() as $cid) { + yield $cid; + } + } +} diff --git a/vendor/hyperf/engine/src/DefaultOption.php b/vendor/hyperf/engine/src/DefaultOption.php new file mode 100644 index 0000000..81edd0b --- /dev/null +++ b/vendor/hyperf/engine/src/DefaultOption.php @@ -0,0 +1,28 @@ +getFin()) { + $flags |= SWOOLE_WEBSOCKET_FLAG_FIN; + } + if ($frame->getRSV1()) { + $flags |= SWOOLE_WEBSOCKET_FLAG_RSV1; + } + if ($frame->getRSV2()) { + $flags |= SWOOLE_WEBSOCKET_FLAG_RSV2; + } + if ($frame->getRSV3()) { + $flags |= SWOOLE_WEBSOCKET_FLAG_RSV3; + } + if ($frame->getMask()) { + $flags |= SWOOLE_WEBSOCKET_FLAG_MASK; + } + + return $flags; +} diff --git a/vendor/hyperf/engine/src/Http/Client.php b/vendor/hyperf/engine/src/Http/Client.php new file mode 100644 index 0000000..ea8afde --- /dev/null +++ b/vendor/hyperf/engine/src/Http/Client.php @@ -0,0 +1,81 @@ +setMethod($method); + $this->setData($contents); + $this->setHeaders($this->encodeHeaders($headers)); + $this->execute($path); + if ($this->errCode !== 0) { + throw new HttpClientException($this->errMsg, $this->errCode); + } + return new RawResponse( + $this->statusCode, + $this->decodeHeaders($this->headers ?? []), + $this->body, + $version + ); + } + + /** + * @param string[] $headers + * @return string[][] + */ + private function decodeHeaders(array $headers): array + { + $result = []; + foreach ($headers as $name => $header) { + // The key of header is lower case. + if (is_array($header)) { + $result[$name] = $header; + } else { + $result[$name][] = $header; + } + } + if ($this->set_cookie_headers) { + $result['set-cookie'] = $this->set_cookie_headers; + } + return $result; + } + + /** + * Swoole engine not support two-dimensional array. + * @param string[][] $headers + * @return string[] + */ + private function encodeHeaders(array $headers): array + { + $result = []; + foreach ($headers as $name => $value) { + $result[$name] = is_array($value) ? implode(',', $value) : $value; + } + + return $result; + } +} diff --git a/vendor/hyperf/engine/src/Http/EventStream.php b/vendor/hyperf/engine/src/Http/EventStream.php new file mode 100644 index 0000000..04ac268 --- /dev/null +++ b/vendor/hyperf/engine/src/Http/EventStream.php @@ -0,0 +1,43 @@ +connection->getSocket(); + $socket->header('Content-Type', 'text/event-stream; charset=utf-8'); + $socket->header('Transfer-Encoding', 'chunked'); + $socket->header('Cache-Control', 'no-cache'); + foreach ($response?->getHeaders() ?? [] as $name => $values) { + $socket->header($name, implode(', ', $values)); + } + } + + public function write(string $data): self + { + $this->connection->write($data); + return $this; + } + + public function end(): void + { + $this->connection->end(); + } +} diff --git a/vendor/hyperf/engine/src/Http/FdGetter.php b/vendor/hyperf/engine/src/Http/FdGetter.php new file mode 100644 index 0000000..f21d03b --- /dev/null +++ b/vendor/hyperf/engine/src/Http/FdGetter.php @@ -0,0 +1,23 @@ +fd; + } +} diff --git a/vendor/hyperf/engine/src/Http/Http.php b/vendor/hyperf/engine/src/Http/Http.php new file mode 100644 index 0000000..d0666dd --- /dev/null +++ b/vendor/hyperf/engine/src/Http/Http.php @@ -0,0 +1,56 @@ + $values) { + foreach ((array) $values as $value) { + $headerString .= sprintf("%s: %s\r\n", $key, $value); + } + } + + return sprintf( + "%s %s HTTP/%s\r\n%s\r\n%s", + $method, + $path, + $protocolVersion, + $headerString, + $body + ); + } + + public static function packResponse(int $statusCode, string $reasonPhrase = '', array $headers = [], string|Stringable $body = '', string $protocolVersion = HttpContract::DEFAULT_PROTOCOL_VERSION): string + { + $headerString = ''; + foreach ($headers as $key => $values) { + foreach ((array) $values as $value) { + $headerString .= sprintf("%s: %s\r\n", $key, $value); + } + } + return sprintf( + "HTTP/%s %s %s\r\n%s\r\n%s", + $protocolVersion, + $statusCode, + $reasonPhrase, + $headerString, + $body + ); + } +} diff --git a/vendor/hyperf/engine/src/Http/RawResponse.php b/vendor/hyperf/engine/src/Http/RawResponse.php new file mode 100644 index 0000000..bd26e4d --- /dev/null +++ b/vendor/hyperf/engine/src/Http/RawResponse.php @@ -0,0 +1,45 @@ +statusCode; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function getBody(): string + { + return $this->body; + } + + public function getVersion(): string + { + return $this->version; + } +} diff --git a/vendor/hyperf/engine/src/Http/Server.php b/vendor/hyperf/engine/src/Http/Server.php new file mode 100644 index 0000000..c21a36d --- /dev/null +++ b/vendor/hyperf/engine/src/Http/Server.php @@ -0,0 +1,77 @@ +host = $name; + $this->port = $port; + + $this->server = new HttpServer($name, $port, reuse_port: true); + return $this; + } + + public function handle(callable $callable): static + { + $this->handler = $callable; + return $this; + } + + public function start(): void + { + $this->server->handle('/', function ($request, $response) { + Coroutine::create(function () use ($request, $response) { + try { + $handler = $this->handler; + + $handler(Request::loadFromSwooleRequest($request), $response); + } catch (Throwable $exception) { + $this->logger->critical((string) $exception); + } + }); + }); + + $this->server->start(); + } + + public function close(): bool + { + $this->server->shutdown(); + + return true; + } +} diff --git a/vendor/hyperf/engine/src/Http/ServerFactory.php b/vendor/hyperf/engine/src/Http/ServerFactory.php new file mode 100644 index 0000000..d0f77ba --- /dev/null +++ b/vendor/hyperf/engine/src/Http/ServerFactory.php @@ -0,0 +1,31 @@ +logger); + + return $server->bind($name, $port); + } +} diff --git a/vendor/hyperf/engine/src/Http/Stream.php b/vendor/hyperf/engine/src/Http/Stream.php new file mode 100755 index 0000000..ecd049f --- /dev/null +++ b/vendor/hyperf/engine/src/Http/Stream.php @@ -0,0 +1,237 @@ +size = strlen($this->contents); + $this->writable = true; + } + + /** + * Reads all data from the stream into a string, from the beginning to end. + * This method MUST attempt to seek to the beginning of the stream before + * reading data and read the stream until the end is reached. + * Warning: This could attempt to load a large amount of data into memory. + * This method MUST NOT raise an exception in order to conform with PHP's + * string casting operations. + * + * @see http://php.net/manual/en/language.oop5.magic.php#object.tostring + */ + public function __toString(): string + { + try { + return $this->getContents(); + } catch (Throwable) { + return ''; + } + } + + /** + * Closes the stream and any underlying resources. + */ + public function close(): void + { + $this->detach(); + } + + /** + * Separates any underlying resources from the stream. + * After the stream has been detached, the stream is in an unusable state. + * + * @return null|resource Underlying PHP stream, if any + */ + public function detach() + { + $this->contents = ''; + $this->size = 0; + $this->writable = false; + + return null; + } + + /** + * Get the size of the stream if known. + * + * @return null|int returns the size in bytes if known, or null if unknown + */ + public function getSize(): ?int + { + if (! $this->size) { + $this->size = strlen($this->getContents()); + } + return $this->size; + } + + /** + * Returns the current position of the file read/write pointer. + * + * @return int Position of the file pointer + * @throws RuntimeException on error + */ + public function tell(): int + { + throw new RuntimeException('Cannot determine the position of a SwooleStream'); + } + + /** + * Returns true if the stream is at the end of the stream. + */ + public function eof(): bool + { + return $this->getSize() === 0; + } + + /** + * Returns whether or not the stream is seekable. + */ + public function isSeekable(): bool + { + return false; + } + + /** + * Seek to a position in the stream. + * + * @see http://www.php.net/manual/en/function.fseek.php + * @param int $offset Stream offset + * @param int $whence Specifies how the cursor position will be calculated + * based on the seek offset. Valid values are identical to the built-in + * PHP $whence values for `fseek()`. SEEK_SET: Set position equal to + * offset bytes SEEK_CUR: Set position to current location plus offset + * SEEK_END: Set position to end-of-stream plus offset. + * @throws RuntimeException on failure + */ + public function seek($offset, $whence = SEEK_SET): void + { + throw new RuntimeException('Cannot seek a SwooleStream'); + } + + /** + * Seek to the beginning of the stream. + * If the stream is not seekable, this method will raise an exception; + * otherwise, it will perform a seek(0). + * + * @throws RuntimeException on failure + * @see http://www.php.net/manual/en/function.fseek.php + * @see seek() + */ + public function rewind(): void + { + $this->seek(0); + } + + /** + * Returns whether or not the stream is writable. + */ + public function isWritable(): bool + { + return $this->writable; + } + + /** + * Write data to the stream. + * + * @param string $string the string that is to be written + * @return int returns the number of bytes written to the stream + * @throws RuntimeException on failure + */ + public function write($string): int + { + if (! $this->writable) { + throw new RuntimeException('Cannot write to a non-writable stream'); + } + + $size = strlen($string); + + $this->contents .= $string; + $this->size += $size; + + return $size; + } + + /** + * Returns whether or not the stream is readable. + */ + public function isReadable(): bool + { + return true; + } + + /** + * Read data from the stream. + * + * @param int $length Read up to $length bytes from the object and return + * them. Fewer than $length bytes may be returned if underlying stream + * call returns fewer bytes. + * @return string returns the data read from the stream, or an empty string + * if no bytes are available + * @throws RuntimeException if an error occurs + */ + public function read($length): string + { + if ($length >= $this->getSize()) { + $result = $this->contents; + $this->contents = ''; + $this->size = 0; + } else { + $result = substr($this->contents, 0, $length); + $this->contents = substr($this->contents, $length); + $this->size = $this->getSize() - $length; + } + + return $result; + } + + /** + * Returns the remaining contents in a string. + * + * @throws RuntimeException if unable to read or an error occurs while + * reading + */ + public function getContents(): string + { + return $this->contents; + } + + /** + * Get stream metadata as an associative array or retrieve a specific key. + * The keys returned are identical to the keys returned from PHP's + * stream_get_meta_data() function. + * + * @see http://php.net/manual/en/function.stream-get-meta-data.php + * @param string $key specific metadata to retrieve + * @return null|array|mixed Returns an associative array if no key is + * provided. Returns a specific key value if a key is provided and the + * value is found, or null if the key is not found. + */ + public function getMetadata($key = null) + { + throw new BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/hyperf/engine/src/Http/V2/Client.php b/vendor/hyperf/engine/src/Http/V2/Client.php new file mode 100644 index 0000000..5246e08 --- /dev/null +++ b/vendor/hyperf/engine/src/Http/V2/Client.php @@ -0,0 +1,104 @@ +client = new HTTP2Client($host, $port, $ssl); + + if ($settings) { + $this->client->set($settings); + } + + $this->client->connect(); + } + + public function set(array $settings): bool + { + return $this->client->set($settings); + } + + public function send(RequestInterface $request): int + { + $res = $this->client->send($this->transformRequest($request)); + if ($res === false) { + throw new HttpClientException($this->client->errMsg, $this->client->errCode); + } + + return $res; + } + + public function recv(float $timeout = 0): ResponseInterface + { + $response = $this->client->recv($timeout); + if ($response === false) { + throw new HttpClientException($this->client->errMsg, $this->client->errCode); + } + + return $this->transformResponse($response); + } + + public function write(int $streamId, mixed $data, bool $end = false): bool + { + return $this->client->write($streamId, $data, $end); + } + + public function ping(): bool + { + return $this->client->ping(); + } + + public function close(): bool + { + return $this->client->close(); + } + + public function isConnected(): bool + { + return $this->client->connected; + } + + private function transformResponse(SwResponse $response): ResponseInterface + { + return new Response( + $response->streamId, + $response->statusCode, + $response->headers ?? [], + $response->data, + ); + } + + private function transformRequest(RequestInterface $request): SwRequest + { + $req = new SwRequest(); + $req->method = $request->getMethod(); + $req->path = $request->getPath(); + $req->headers = $request->getHeaders(); + $req->data = $request->getBody(); + $req->pipeline = $request->isPipeline(); + $req->usePipelineRead = $request->isPipeline(); + return $req; + } +} diff --git a/vendor/hyperf/engine/src/Http/V2/ClientFactory.php b/vendor/hyperf/engine/src/Http/V2/ClientFactory.php new file mode 100644 index 0000000..23346cb --- /dev/null +++ b/vendor/hyperf/engine/src/Http/V2/ClientFactory.php @@ -0,0 +1,23 @@ +path; + } + + public function setPath(string $path): void + { + $this->path = $path; + } + + public function getMethod(): string + { + return $this->method; + } + + public function setMethod(string $method): void + { + $this->method = $method; + } + + public function getBody(): string + { + return $this->body; + } + + public function setBody(string $body): void + { + $this->body = $body; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function setHeaders(array $headers): void + { + $this->headers = $headers; + } + + public function isPipeline(): bool + { + return $this->pipeline; + } + + public function setPipeline(bool $pipeline): void + { + $this->pipeline = $pipeline; + } +} diff --git a/vendor/hyperf/engine/src/Http/V2/Response.php b/vendor/hyperf/engine/src/Http/V2/Response.php new file mode 100644 index 0000000..00a6909 --- /dev/null +++ b/vendor/hyperf/engine/src/Http/V2/Response.php @@ -0,0 +1,42 @@ +streamId; + } + + public function getStatusCode(): int + { + return $this->statusCode; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function getBody(): ?string + { + return $this->body; + } +} diff --git a/vendor/hyperf/engine/src/Http/WritableConnection.php b/vendor/hyperf/engine/src/Http/WritableConnection.php new file mode 100644 index 0000000..a2b8dfb --- /dev/null +++ b/vendor/hyperf/engine/src/Http/WritableConnection.php @@ -0,0 +1,41 @@ +response->write($data); + } + + /** + * @return Response + */ + public function getSocket(): mixed + { + return $this->response; + } + + public function end(): ?bool + { + return $this->response->end(); + } +} diff --git a/vendor/hyperf/engine/src/ResponseEmitter.php b/vendor/hyperf/engine/src/ResponseEmitter.php new file mode 100644 index 0000000..ac055c4 --- /dev/null +++ b/vendor/hyperf/engine/src/ResponseEmitter.php @@ -0,0 +1,95 @@ +header['Upgrade'] ?? '') === 'websocket') { + return; + } + $this->buildSwooleResponse($connection, $response); + $content = $response->getBody(); + if ($content instanceof FileInterface) { + $connection->sendfile($content->getFilename()); + return; + } + + if ($withContent) { + $connection->end((string) $content); + } else { + $connection->end(); + } + } catch (Throwable $exception) { + $this->logger?->critical((string) $exception); + } + } + + protected function buildSwooleResponse(Response $swooleResponse, ResponseInterface $response): void + { + // Headers + foreach ($response->getHeaders() as $key => $value) { + $swooleResponse->header($key, $value); + } + + if ($response instanceof HyperfResponse) { + // Cookies + foreach ((array) $response->getCookies() as $domain => $paths) { + foreach ($paths ?? [] as $path => $item) { + foreach ($item ?? [] as $name => $cookie) { + if ($cookie instanceof Cookie) { + $value = $cookie->isRaw() ? $cookie->getValue() : rawurlencode($cookie->getValue()); + $swooleResponse->rawcookie($cookie->getName(), $value, $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly(), (string) $cookie->getSameSite()); + } + } + } + } + + // Trailers + foreach ($response->getTrailers() ?? [] as $key => $value) { + $swooleResponse->trailer($key, $value); + } + } + + // Status code + $swooleResponse->status($response->getStatusCode(), $response->getReasonPhrase()); + } + + protected function isMethodsExists(object $object, array $methods): bool + { + foreach ($methods as $method) { + if (! method_exists($object, $method)) { + return false; + } + } + return true; + } +} diff --git a/vendor/hyperf/engine/src/SafeSocket.php b/vendor/hyperf/engine/src/SafeSocket.php new file mode 100644 index 0000000..a2d08f4 --- /dev/null +++ b/vendor/hyperf/engine/src/SafeSocket.php @@ -0,0 +1,133 @@ +channel = new Channel($capacity); + } + + /** + * @throws SocketTimeoutException when send data timeout + * @throws SocketClosedException when the client is closed + */ + public function sendAll(string $data, float $timeout = 0): false|int + { + $this->loop(); + + $res = $this->channel->push([$data, $timeout], $timeout); + if ($res === false) { + if ($this->channel->isClosing()) { + $this->throw && throw new SocketClosedException('The channel is closed.'); + } + if ($this->channel->isTimeout()) { + $this->throw && throw new SocketTimeoutException('The channel is full.'); + } + + return false; + } + return strlen($data); + } + + /** + * @throws SocketTimeoutException when send data timeout + * @throws SocketClosedException when the client is closed + */ + public function recvAll(int $length = 65536, float $timeout = 0): false|string + { + $res = $this->socket->recvAll($length, $timeout); + if (! $res) { + if ($this->socket->errCode === SOCKET_ETIMEDOUT) { + $this->throw && throw new SocketTimeoutException('Recv timeout'); + } + + $this->throw && throw new SocketClosedException('The socket is closed.'); + } + + return $res; + } + + /** + * @throws SocketTimeoutException when send data timeout + * @throws SocketClosedException when the client is closed + */ + public function recvPacket(float $timeout = 0): false|string + { + $res = $this->socket->recvPacket($timeout); + if (! $res) { + if ($this->socket->errCode === SOCKET_ETIMEDOUT) { + $this->throw && throw new SocketTimeoutException('Recv timeout'); + } + + $this->throw && throw new SocketClosedException('The socket is closed.'); + } + + return $res; + } + + public function close(): bool + { + $this->channel->close(); + + return $this->socket->close(); + } + + public function setLogger(?LoggerInterface $logger): static + { + $this->logger = $logger; + return $this; + } + + protected function loop(): void + { + if ($this->loop) { + return; + } + + $this->loop = true; + + Coroutine::create(function () { + try { + while (true) { + $data = $this->channel->pop(-1); + if ($this->channel->isClosing()) { + return; + } + + [$data, $timeout] = $data; + + $this->socket->sendAll($data, $timeout); + } + } catch (Throwable $exception) { + $this->logger?->critical((string) $exception); + } + }); + } +} diff --git a/vendor/hyperf/engine/src/Signal.php b/vendor/hyperf/engine/src/Signal.php new file mode 100644 index 0000000..8d2f010 --- /dev/null +++ b/vendor/hyperf/engine/src/Signal.php @@ -0,0 +1,24 @@ +getProtocol()) { + $socket->setProtocol($protocol); + } + + if ($option->getTimeout() === null) { + $res = $socket->connect($option->getHost(), $option->getPort()); + } else { + $res = $socket->connect($option->getHost(), $option->getPort(), $option->getTimeout()); + } + + if (! $res) { + throw new SocketConnectException($socket->errMsg, $socket->errCode); + } + + return $socket; + } +} diff --git a/vendor/hyperf/engine/src/Socket/SocketOption.php b/vendor/hyperf/engine/src/Socket/SocketOption.php new file mode 100644 index 0000000..d4ad56a --- /dev/null +++ b/vendor/hyperf/engine/src/Socket/SocketOption.php @@ -0,0 +1,42 @@ +host; + } + + public function getPort(): int + { + return $this->port; + } + + public function getTimeout(): ?float + { + return $this->timeout; + } + + public function getProtocol(): array + { + return $this->protocol; + } +} diff --git a/vendor/hyperf/engine/src/WebSocket/Frame.php b/vendor/hyperf/engine/src/WebSocket/Frame.php new file mode 100644 index 0000000..c29a633 --- /dev/null +++ b/vendor/hyperf/engine/src/WebSocket/Frame.php @@ -0,0 +1,214 @@ +setPayloadData($payloadData); + } + + public function __toString() + { + return $this->toString(); + } + + public function getOpcode(): int + { + return $this->opcode; + } + + public function setOpcode(int $opcode): static + { + $this->opcode = $opcode; + return $this; + } + + public function withOpcode(int $opcode): static + { + return (clone $this)->setOpcode($opcode); + } + + public function getFin(): bool + { + return $this->fin; + } + + public function setFin(bool $fin): static + { + $this->fin = $fin; + return $this; + } + + public function withFin(bool $fin): static + { + return (clone $this)->setFin($fin); + } + + public function getRSV1(): bool + { + return $this->rsv1; + } + + public function setRSV1(bool $rsv1): static + { + $this->rsv1 = $rsv1; + return $this; + } + + public function withRSV1(bool $rsv1): static + { + return (clone $this)->setRSV1($rsv1); + } + + public function getRSV2(): bool + { + return $this->rsv2; + } + + public function setRSV2(bool $rsv2): static + { + $this->rsv2 = $rsv2; + return $this; + } + + public function withRSV2(bool $rsv2): static + { + return (clone $this)->setRSV2($rsv2); + } + + public function getRSV3(): bool + { + return $this->rsv3; + } + + public function setRSV3(bool $rsv3): static + { + $this->rsv3 = $rsv3; + return $this; + } + + public function withRSV3(bool $rsv3): static + { + return (clone $this)->setRSV3($rsv3); + } + + public function getPayloadLength(): int + { + return $this->payloadData->getSize() ?? 0; + } + + public function setPayloadLength(int $payloadLength): static + { + $this->payloadLength = $payloadLength; + return $this; + } + + public function withPayloadLength(int $payloadLength): static + { + return (clone $this)->setPayloadLength($payloadLength); + } + + public function getMask(): bool + { + return ! empty($this->maskingKey); + } + + public function getMaskingKey(): string + { + return $this->maskingKey; + } + + public function setMaskingKey(string $maskingKey): static + { + $this->maskingKey = $maskingKey; + return $this; + } + + public function withMaskingKey(string $maskingKey): static + { + return (clone $this)->setMaskingKey($maskingKey); + } + + public function getPayloadData(): StreamInterface + { + return $this->payloadData; + } + + public function setPayloadData(mixed $payloadData): static + { + $this->payloadData = new Stream((string) $payloadData); + return $this; + } + + public function withPayloadData(mixed $payloadData): static + { + return (clone $this)->setPayloadData($payloadData); + } + + public function toString(bool $withoutPayloadData = false): string + { + return SwooleFrame::pack( + (string) $this->getPayloadData(), + $this->getOpcode(), + swoole_get_flags_from_frame($this) + ); + } + + public static function from(mixed $frame): static + { + if (! $frame instanceof SwooleFrame) { + throw new InvalidArgumentException('The frame is invalid.'); + } + + return new Frame( + (bool) ($frame->flags & SWOOLE_WEBSOCKET_FLAG_FIN), + (bool) ($frame->flags & SWOOLE_WEBSOCKET_FLAG_RSV1), + (bool) ($frame->flags & SWOOLE_WEBSOCKET_FLAG_RSV2), + (bool) ($frame->flags & SWOOLE_WEBSOCKET_FLAG_RSV3), + $frame->opcode, + strlen($frame->data), + $frame->flags & SWOOLE_WEBSOCKET_FLAG_MASK ? '258E' : '', + $frame->data + ); + } +} diff --git a/vendor/hyperf/engine/src/WebSocket/Opcode.php b/vendor/hyperf/engine/src/WebSocket/Opcode.php new file mode 100644 index 0000000..d2cebee --- /dev/null +++ b/vendor/hyperf/engine/src/WebSocket/Opcode.php @@ -0,0 +1,28 @@ +getPayloadData(); + $flags = swoole_get_flags_from_frame($frame); + + if ($this->connection instanceof SwooleResponse) { + $this->connection->push($data, $frame->getOpcode(), $flags); + return true; + } + + if ($this->connection instanceof Server) { + $this->connection->push($this->fd, $data, $frame->getOpcode(), $flags); + return true; + } + + throw new InvalidArgumentException('The websocket connection is invalid.'); + } + + public function init(mixed $frame): static + { + switch (true) { + case is_int($frame): + $this->fd = $frame; + break; + case $frame instanceof Request || $frame instanceof SwooleFrame: + $this->fd = $frame->fd; + break; + } + + return $this; + } + + public function getFd(): int + { + return $this->fd; + } + + public function close(): bool + { + if ($this->connection instanceof SwooleResponse) { + return $this->connection->close(); + } + + if ($this->connection instanceof Server) { + return $this->connection->disconnect($this->fd); + } + + return false; + } +} diff --git a/vendor/hyperf/engine/src/WebSocket/WebSocket.php b/vendor/hyperf/engine/src/WebSocket/WebSocket.php new file mode 100644 index 0000000..7ce43dc --- /dev/null +++ b/vendor/hyperf/engine/src/WebSocket/WebSocket.php @@ -0,0 +1,81 @@ + + */ + protected array $events = []; + + public function __construct(Response $connection, Request $request, protected ?LoggerInterface $logger = null) + { + $this->connection = $connection; + $this->connection->upgrade(); + } + + public function on(string $event, callable $callback): void + { + $this->events[$event] = $callback; + } + + public function start(): void + { + while (true) { + /** @var false|string|SwFrame $frame */ + $frame = $this->connection->recv(-1); + if ($frame === false) { + $this->logger?->warning( + sprintf( + '%s:(%s) %s', + 'Websocket recv failed:', + swoole_last_error(), + swoole_strerror(swoole_last_error(), 9) + ) + ); + } + + if ($frame === false || $frame instanceof CloseFrame || $frame === '') { + if ($callback = $this->events[static::ON_CLOSE] ?? null) { + $callback($this->connection, $this->connection->fd); + } + break; + } + + switch ($frame->opcode) { + case Opcode::PING: + $this->connection->push('', Opcode::PONG); + break; + case Opcode::PONG: + break; + default: + if ($callback = $this->events[static::ON_MESSAGE] ?? null) { + $callback($this->connection, $frame); + } + } + } + + $this->connection = null; + $this->events = []; + } +} diff --git a/vendor/hyperf/pimple/.gitattributes b/vendor/hyperf/pimple/.gitattributes new file mode 100644 index 0000000..27b765f --- /dev/null +++ b/vendor/hyperf/pimple/.gitattributes @@ -0,0 +1,2 @@ +/tests export-ignore +/.github export-ignore diff --git a/vendor/hyperf/pimple/.gitignore b/vendor/hyperf/pimple/.gitignore new file mode 100644 index 0000000..7e11e88 --- /dev/null +++ b/vendor/hyperf/pimple/.gitignore @@ -0,0 +1,4 @@ +/vendor/ +composer.lock +*.cache +*.log \ No newline at end of file diff --git a/vendor/hyperf/pimple/.php-cs-fixer.php b/vendor/hyperf/pimple/.php-cs-fixer.php new file mode 100644 index 0000000..00cc143 --- /dev/null +++ b/vendor/hyperf/pimple/.php-cs-fixer.php @@ -0,0 +1,97 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + '@Symfony' => true, + '@DoctrineAnnotation' => true, + '@PhpCsFixer' => true, + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => $header, + 'separate' => 'none', + 'location' => 'after_declare_strict', + ], + 'array_syntax' => [ + 'syntax' => 'short' + ], + 'list_syntax' => [ + 'syntax' => 'short' + ], + 'concat_space' => [ + 'spacing' => 'one' + ], + 'blank_line_before_statement' => [ + 'statements' => [ + 'declare', + ], + ], + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author' + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', 'function', 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'single_line_comment_style' => [ + 'comment_types' => [ + ], + ], + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + ], + 'phpdoc_align' => [ + 'align' => 'left', + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'constant_case' => [ + 'case' => 'lower', + ], + 'global_namespace_import' => [ + 'import_classes' => true, + 'import_constants' => true, + 'import_functions' => true, + ], + 'class_attributes_separation' => true, + 'combine_consecutive_unsets' => true, + 'declare_strict_types' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_static_reference' => true, + 'no_useless_else' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'not_operator_with_space' => false, + 'ordered_class_elements' => true, + 'php_unit_strict' => false, + 'phpdoc_separation' => false, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'multiline_comment_opening_closing' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('bin') + ->exclude('public') + ->exclude('runtime') + ->exclude('vendor') + ->in(__DIR__) + ) + ->setUsingCache(false); diff --git a/vendor/hyperf/pimple/.phpstorm.meta.php b/vendor/hyperf/pimple/.phpstorm.meta.php new file mode 100644 index 0000000..1014069 --- /dev/null +++ b/vendor/hyperf/pimple/.phpstorm.meta.php @@ -0,0 +1,6 @@ +set(TranslatorLoaderInterface::class, function () use ($container) { + $config = $container->get(ConfigInterface::class); + $files = $container->get(Filesystem::class); + $path = $config->get('translation.path'); + + return make(FileLoader::class, compact('files', 'path')); + }); + } +} +``` + +```php +set(TranslatorInterface::class, function () use ($container) { + $config = $container->get(ConfigInterface::class); + $locale = $config->get('translation.locale'); + $fallbackLocale = $config->get('translation.fallback_locale'); + + $loader = $container->get(TranslatorLoaderInterface::class); + + $translator = make(Translator::class, compact('loader', 'locale')); + $translator->setFallback((string) $fallbackLocale); + + return $translator; + }); + } +} + +``` + +3. `EasySwoole` 事件注册器在 `EasySwooleEvent.php` 中,所以我们需要在 `initialize()` 中初始化我们的容器和国际化组件。 + +> 以下 Config 组件,可以自行封装,这里方便起见直接配置。 + +```php +set(ConfigInterface::class, new Config([ + 'translation' => [ + 'locale' => 'zh_CN', + 'fallback_locale' => 'en', + 'path' => EASYSWOOLE_ROOT . '/storage/languages', + ], + ])); + } +} +``` + +4. 修改控制器,使用国际化组件 + +```php +get(TranslatorInterface::class); + + $data = [ + 'message' => $translator->trans('message.hello', ['name' => 'Hyperf']), + ]; + + $this->response()->write(Json::encode($data)); + } +} + +``` + +5. 添加国际化配置 + +```php +// storage/languages/en/message.php +return [ + 'hello' => 'Hello :name', +]; + +// storage/languages/zh_CN/message.php +return [ + 'hello' => '你好 :name', +]; +``` + +6. 测试 + +``` +$ curl http://127.0.0.1:9501/ +{"message":"你好 Hyperf"} +``` + + + diff --git a/vendor/hyperf/pimple/composer.json b/vendor/hyperf/pimple/composer.json new file mode 100644 index 0000000..7cc2d45 --- /dev/null +++ b/vendor/hyperf/pimple/composer.json @@ -0,0 +1,54 @@ +{ + "name": "hyperf/pimple", + "type": "library", + "license": "MIT", + "keywords": [ + "php", + "hyperf", + "container", + "psr11" + ], + "description": "Pimple Container", + "autoload": { + "psr-4": { + "Hyperf\\Pimple\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "HyperfTest\\": "tests" + } + }, + "require": { + "php": ">=8.0", + "hyperf/context": "^3.0", + "hyperf/contract": "^3.0", + "pimple/pimple": "^3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.0", + "hyperf/support": "^3.0", + "mockery/mockery": "^1.3", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": ">=7.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "scripts": { + "test": "phpunit -c phpunit.xml --colors=always", + "analyse": "phpstan analyse --memory-limit 300M -l 0 ./src", + "cs-fix": "php-cs-fixer fix $1" + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + }, + "hyperf": { + "config": "Hyperf\\Pimple\\ConfigProvider" + } + } +} diff --git a/vendor/hyperf/pimple/phpunit.xml b/vendor/hyperf/pimple/phpunit.xml new file mode 100644 index 0000000..d2c615a --- /dev/null +++ b/vendor/hyperf/pimple/phpunit.xml @@ -0,0 +1,15 @@ + + + + ./tests/ + + \ No newline at end of file diff --git a/vendor/hyperf/pimple/src/ConfigProvider.php b/vendor/hyperf/pimple/src/ConfigProvider.php new file mode 100644 index 0000000..be00f3f --- /dev/null +++ b/vendor/hyperf/pimple/src/ConfigProvider.php @@ -0,0 +1,32 @@ + [ + ], + 'commands' => [ + ], + 'annotations' => [ + 'scan' => [ + 'paths' => [ + __DIR__, + ], + ], + ], + ]; + } +} diff --git a/vendor/hyperf/pimple/src/Container.php b/vendor/hyperf/pimple/src/Container.php new file mode 100644 index 0000000..541e495 --- /dev/null +++ b/vendor/hyperf/pimple/src/Container.php @@ -0,0 +1,133 @@ +pimple[ContainerInterface::class] = $this; + $this->pimple[PsrContainerInterface::class] = $this; + } + + public function get($id) + { + if ($this->has($id)) { + return $this->pimple[$id]; + } + + return $this->pimple[$id] = $this->make($id); + } + + public function has($id): bool + { + return isset($this->pimple[$id]); + } + + public function make(string $name, array $parameters = []) + { + if (! class_exists($name)) { + throw new NotFoundException("Entry {$name} is not found."); + } + + $ref = $this->reflection[$name] ?? new ReflectionClass($name); + $constructor = $ref->getConstructor(); + $args = []; + if ($constructor && $constructor->isPublic()) { + $args = $this->resolveParameters($constructor, $parameters); + } + + $instance = new $name(...$args); + + $this->reflection[$name] = $ref; + + return $instance; + } + + public function set(string $name, $entry): void + { + $this->pimple[$name] = $entry; + } + + public function define(string $name, $definition): void + { + throw new NotSupportException('Method define is not support.'); + } + + public function unbind(string $name): void + { + $this->pimple[$name] = null; + } + + protected function resolveParameters(ReflectionMethod $method, $parameters = []) + { + $args = []; + foreach ($method->getParameters() as $index => $parameter) { + if (array_key_exists($parameter->getName(), $parameters)) { + $value = $parameters[$parameter->getName()]; + } elseif (array_key_exists($index, $parameters)) { + $value = $parameters[$index]; + } elseif ($parameter->getType() && $this->has($parameter->getType()->getName())) { + $value = $this->get($parameter->getType()->getName()); + } else { + if ($parameter->isDefaultValueAvailable() || $parameter->isOptional()) { + $value = $this->getParameterDefaultValue($parameter, $method); + } else { + throw new InvalidDefinitionException(sprintf( + 'Parameter $%s of %s has no value defined or guessable', + $parameter->getName(), + $this->getFunctionName($method) + )); + } + } + + $args[] = $value; + } + + return $args; + } + + protected function getParameterDefaultValue(ReflectionParameter $parameter, ReflectionMethod $function) + { + try { + return $parameter->getDefaultValue(); + } catch (ReflectionException $e) { + throw new InvalidDefinitionException(sprintf( + 'The parameter "%s" of %s has no type defined or guessable. It has a default value, ' + . 'but the default value can\'t be read through Reflection because it is a PHP internal class.', + $parameter->getName(), + $this->getFunctionName($function) + )); + } + } + + private function getFunctionName(ReflectionMethod $method): string + { + return $method->getName() . '()'; + } +} diff --git a/vendor/hyperf/pimple/src/ContainerFactory.php b/vendor/hyperf/pimple/src/ContainerFactory.php new file mode 100644 index 0000000..8b74492 --- /dev/null +++ b/vendor/hyperf/pimple/src/ContainerFactory.php @@ -0,0 +1,34 @@ +providers as $provider) { + /** @var ProviderInterface $instance */ + $instance = new $provider(); + $instance->register($container); + } + + return ApplicationContext::setContainer($container); + } +} diff --git a/vendor/hyperf/pimple/src/Exception/InvalidDefinitionException.php b/vendor/hyperf/pimple/src/Exception/InvalidDefinitionException.php new file mode 100644 index 0000000..3dce716 --- /dev/null +++ b/vendor/hyperf/pimple/src/Exception/InvalidDefinitionException.php @@ -0,0 +1,19 @@ +