mirror of
https://github.com/crazywhalecc/choir-psr-http.git
synced 2026-03-18 04:34:52 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac7109fa0f | ||
|
|
56416d9b55 | ||
|
|
d7a05ac929 |
6
.github/FUNDING.yml
vendored
6
.github/FUNDING.yml
vendored
@ -1,16 +1,12 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
buymeacoffee: crazywhalecc
|
github: crazywhalecc # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: crazywhalecc # Replace with a single Ko-fi username
|
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
liberapay: # Replace with a single Liberapay username
|
liberapay: # Replace with a single Liberapay username
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
otechie: # Replace with a single Otechie username
|
otechie: # Replace with a single Otechie username
|
||||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
custom:
|
|
||||||
- https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md
|
|
||||||
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2",
|
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4",
|
||||||
"psr/http-client": "^1.0"
|
"psr/http-client": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@ -64,7 +64,7 @@
|
|||||||
"[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add"
|
"[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add"
|
||||||
],
|
],
|
||||||
"analyse": "phpstan analyse --memory-limit 300M",
|
"analyse": "phpstan analyse --memory-limit 300M",
|
||||||
"cs-fix": "php-cs-fixer fix",
|
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix",
|
||||||
"test": "phpunit --no-coverage"
|
"test": "phpunit --no-coverage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,17 +32,11 @@ class CurlClient implements ClientInterface, TimeoutInterface
|
|||||||
$this->curl_options = $curl_options;
|
$this->curl_options = $curl_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function setTimeout(int $timeout)
|
public function setTimeout(int $timeout)
|
||||||
{
|
{
|
||||||
$this->curl_options[CURLOPT_TIMEOUT_MS] = $timeout;
|
$this->curl_options[CURLOPT_TIMEOUT_MS] = $timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function sendRequest(RequestInterface $request): ResponseInterface
|
public function sendRequest(RequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
$handle = $this->createHandle($request);
|
$handle = $this->createHandle($request);
|
||||||
|
|||||||
@ -6,6 +6,4 @@ namespace Choir\Http\Client\Exception;
|
|||||||
|
|
||||||
use Psr\Http\Client\ClientExceptionInterface;
|
use Psr\Http\Client\ClientExceptionInterface;
|
||||||
|
|
||||||
class ClientException extends \Exception implements ClientExceptionInterface
|
class ClientException extends \Exception implements ClientExceptionInterface {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class NetworkException extends \Exception implements NetworkExceptionInterface
|
|||||||
{
|
{
|
||||||
private RequestInterface $request;
|
private RequestInterface $request;
|
||||||
|
|
||||||
public function __construct(RequestInterface $request, $message = '', $code = 0, \Throwable $previous = null)
|
public function __construct(RequestInterface $request, $message = '', $code = 0, ?\Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|||||||
@ -11,15 +11,12 @@ class RequestException extends \Exception implements RequestExceptionInterface
|
|||||||
{
|
{
|
||||||
private RequestInterface $request;
|
private RequestInterface $request;
|
||||||
|
|
||||||
public function __construct(RequestInterface $request, $message = '', $code = 0, \Throwable $previous = null)
|
public function __construct(RequestInterface $request, $message = '', $code = 0, ?\Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getRequest(): RequestInterface
|
public function getRequest(): RequestInterface
|
||||||
{
|
{
|
||||||
return $this->request;
|
return $this->request;
|
||||||
|
|||||||
@ -44,7 +44,6 @@ class StreamClient implements TimeoutInterface, ClientInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function sendRequest(RequestInterface $request): ResponseInterface
|
public function sendRequest(RequestInterface $request): ResponseInterface
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class Response implements ResponseInterface
|
|||||||
* @param string $version Protocol version
|
* @param string $version Protocol version
|
||||||
* @param null|string $reason Reason phrase (when empty a default will be used based on the status code)
|
* @param null|string $reason Reason phrase (when empty a default will be used based on the status code)
|
||||||
*/
|
*/
|
||||||
public function __construct($status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
|
public function __construct($status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
|
||||||
{
|
{
|
||||||
// If we got nobody, defer initialization of the stream until Response::getBody()
|
// If we got nobody, defer initialization of the stream until Response::getBody()
|
||||||
if ($body !== '' && $body !== null) {
|
if ($body !== '' && $body !== null) {
|
||||||
|
|||||||
@ -38,9 +38,7 @@ class Stream implements StreamInterface
|
|||||||
|
|
||||||
private ?int $size = null;
|
private ?int $size = null;
|
||||||
|
|
||||||
private function __construct()
|
private function __construct() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the stream when the destructed.
|
* Closes the stream when the destructed.
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class UploadedFile implements UploadedFileInterface
|
|||||||
* @var null|string
|
* @var null|string
|
||||||
*/
|
*/
|
||||||
private $file;
|
private $file;
|
||||||
|
|
||||||
private string $key;
|
private string $key;
|
||||||
|
|
||||||
private bool $moved = false;
|
private bool $moved = false;
|
||||||
@ -53,7 +53,7 @@ class UploadedFile implements UploadedFileInterface
|
|||||||
$this->file = $this->fileinfo['tmp_name'];
|
$this->file = $this->fileinfo['tmp_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getKey(): string
|
public function getKey(): string
|
||||||
{
|
{
|
||||||
return $this->key;
|
return $this->key;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class FrameFactory
|
|||||||
return new Frame($payload, Opcode::BINARY, true, true);
|
return new Frame($payload, Opcode::BINARY, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createCloseFrame(int $code = null, string $reason = null): Frame
|
public static function createCloseFrame(?int $code = null, ?string $reason = null): Frame
|
||||||
{
|
{
|
||||||
return new CloseFrame($code, $reason);
|
return new CloseFrame($code, $reason);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
const CHOIR_PSR_HTTP_VERSION = '1.0.2';
|
const CHOIR_PSR_HTTP_VERSION = '1.0.3';
|
||||||
|
|
||||||
// Choir TCP 连接状态
|
// Choir TCP 连接状态
|
||||||
const CHOIR_TCP_INITIAL = 0;
|
const CHOIR_TCP_INITIAL = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user