delete http-message
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Yii template
|
||||
assets/*
|
||||
!assets/.gitignore
|
||||
protected/runtime/*
|
||||
!protected/runtime/.gitignore
|
||||
protected/data/*.db
|
||||
themes/classic/views/
|
||||
|
||||
### Example user template template
|
||||
### Example user template
|
||||
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
|
||||
composer.lock
|
||||
|
||||
*.log
|
||||
commands/result
|
||||
config/setting.php
|
||||
tests/
|
||||
vendor/
|
||||
runtime/
|
||||
|
||||
*.xml
|
||||
*.lock
|
||||
|
||||
oot
|
||||
d
|
||||
|
||||
composer.lock
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META {
|
||||
|
||||
// Reflect
|
||||
use Http\Context\Context;
|
||||
use Kiri\Di\Container;
|
||||
|
||||
override(Container::get(0), map('@'));
|
||||
override(Container::newObject(0), map('@'));
|
||||
// override(\Hyperf\Utils\Context::get(0), map('@'));
|
||||
// override(\make(0), map('@'));
|
||||
override(\di(0), map('@'));
|
||||
override(\duplicate(0), map('@'));
|
||||
override(Context::getContext(0), map('@'));
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "game-worker/http-message",
|
||||
"description": "db",
|
||||
"authors": [
|
||||
{
|
||||
"name": "XiangLin",
|
||||
"email": "as2252258@163.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
"ext-json": "*",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"HttpMessage\\": "src/"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"kwn/php-rdkafka-stubs": "^2.0"
|
||||
}
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace HttpMessage;
|
||||
|
||||
use Http\Context\Context;
|
||||
use Kiri\Di\ContainerInterface;
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Server\RequestInterface;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
trait Message
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $protocol = '1.1';
|
||||
|
||||
|
||||
/**
|
||||
* @var mixed|string
|
||||
*/
|
||||
public mixed $body = '';
|
||||
|
||||
|
||||
/**
|
||||
* @var array<string,array>
|
||||
*/
|
||||
public array $headers = [];
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProtocolVersion(): string
|
||||
{
|
||||
return $this->protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
* @return $this
|
||||
*/
|
||||
public function withProtocolVersion($version): static
|
||||
{
|
||||
// TODO: Implement withProtocolVersion() method.
|
||||
$new = clone $this;
|
||||
$new->protocol = $version;
|
||||
return $new;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders(): array
|
||||
{
|
||||
// TODO: Implement getHeaders() method.
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHeader($name): bool
|
||||
{
|
||||
// TODO: Implement hasHeader() method.
|
||||
return isset($this->headers[$name]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHeader($name): mixed
|
||||
{
|
||||
// TODO: Implement getHeader() method.
|
||||
if (!$this->hasHeader($name)) {
|
||||
return null;
|
||||
}
|
||||
return $this->headers[$name];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return string|null
|
||||
*/
|
||||
public function getHeaderLine($name): ?string
|
||||
{
|
||||
// TODO: Implement getHeaderLine() method.
|
||||
// TODO: Implement getHeader() method.
|
||||
if (!$this->hasHeader($name)) {
|
||||
return null;
|
||||
}
|
||||
return $this->headers[$name];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string|string[] $value
|
||||
* @return Message
|
||||
*/
|
||||
public function withHeader($name, $value): static
|
||||
{
|
||||
// TODO: Implement withHeader() method.
|
||||
$newInstance = clone $this;
|
||||
$newInstance->headers[$name] = [$value];
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string|string[] $value
|
||||
* @return $this
|
||||
*/
|
||||
public function withAddedHeader($name, $value): static
|
||||
{
|
||||
// TODO: Implement withAddedHeader() method.
|
||||
// TODO: Implement withHeader() method.
|
||||
$newInstance = clone $this;
|
||||
if (!isset($newInstance->headers)) {
|
||||
$newInstance->headers[$name] = [$value];
|
||||
} else {
|
||||
$newInstance->headers[$name][] = $value;
|
||||
}
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function withoutHeader($name): static
|
||||
{
|
||||
// TODO: Implement withoutHeader() method.
|
||||
$newInstance = clone $this;
|
||||
if (!isset($newInstance->headers)) {
|
||||
return $newInstance;
|
||||
}
|
||||
unset($newInstance->headers[$name]);
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBody(): mixed
|
||||
{
|
||||
// TODO: Implement getBody() method.
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param StreamInterface $body
|
||||
* @return $this
|
||||
*/
|
||||
public function withBody(StreamInterface $body): static
|
||||
{
|
||||
// TODO: Implement withBody() method.
|
||||
$newInstance = clone $this;
|
||||
$newInstance->body = $body;
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace HttpMessage;
|
||||
|
||||
use Annotation\Inject;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Kiri\Di\ContainerInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Request implements RequestInterface
|
||||
{
|
||||
|
||||
use Message;
|
||||
|
||||
|
||||
public string $method;
|
||||
|
||||
|
||||
public mixed $requestTarget;
|
||||
|
||||
|
||||
/**
|
||||
* @var UriInterface
|
||||
*/
|
||||
#[Inject(UriInterface::class)]
|
||||
public UriInterface $uri;
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function __construct(public ContainerInterface $container)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRequestTarget(): mixed
|
||||
{
|
||||
// TODO: Implement getRequestTarget() method.
|
||||
return $this->requestTarget;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $requestTarget
|
||||
* @return Request
|
||||
*/
|
||||
public function withRequestTarget($requestTarget): static
|
||||
{
|
||||
// TODO: Implement withRequestTarget() method.
|
||||
$newInstance = clone $this;
|
||||
$newInstance->requestTarget = $requestTarget;
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod(): string
|
||||
{
|
||||
// TODO: Implement getMethod() method.
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @return $this
|
||||
*/
|
||||
public function withMethod($method): static
|
||||
{
|
||||
// TODO: Implement withMethod() method.
|
||||
$newInstance = clone $this;
|
||||
$newInstance->method = $method;
|
||||
return $newInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function getUri(): string
|
||||
{
|
||||
// TODO: Implement getUri() method.
|
||||
$uri = $this->uri->getPath();
|
||||
if (!empty($this->uri->getQuery())) {
|
||||
$uri .= '?' . $this->uri->getQuery();
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param UriInterface $uri
|
||||
* @param false $preserveHost
|
||||
* @return Request
|
||||
*/
|
||||
public function withUri(UriInterface $uri, $preserveHost = false): static
|
||||
{
|
||||
// TODO: Implement withUri() method.
|
||||
$newInstance = clone $this;
|
||||
$newInstance->uri = $uri;
|
||||
return $newInstance;
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace HttpMessage;
|
||||
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Uri implements UriInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $path = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $host = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public int $port = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $query = '';
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public string $scheme = '';
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getScheme(): string
|
||||
{
|
||||
// TODO: Implement getScheme() method.
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthority(): string
|
||||
{
|
||||
// TODO: Implement getAuthority() method.
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getUserInfo()
|
||||
{
|
||||
// TODO: Implement getUserInfo() method.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHost(): string
|
||||
{
|
||||
// TODO: Implement getHost() method.
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPort(): int
|
||||
{
|
||||
// TODO: Implement getPort() method.
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath(): string
|
||||
{
|
||||
// TODO: Implement getPath() method.
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getQuery(): string
|
||||
{
|
||||
// TODO: Implement getQuery() method.
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFragment(): string
|
||||
{
|
||||
// TODO: Implement getFragment() method.
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $scheme
|
||||
* @return Uri|void
|
||||
*/
|
||||
public function withScheme($scheme): string
|
||||
{
|
||||
// TODO: Implement withScheme() method.
|
||||
|
||||
}
|
||||
|
||||
public function withUserInfo($user, $password = null)
|
||||
{
|
||||
// TODO: Implement withUserInfo() method.
|
||||
}
|
||||
|
||||
public function withHost($host)
|
||||
{
|
||||
// TODO: Implement withHost() method.
|
||||
}
|
||||
|
||||
public function withPort($port)
|
||||
{
|
||||
// TODO: Implement withPort() method.
|
||||
}
|
||||
|
||||
public function withPath($path)
|
||||
{
|
||||
// TODO: Implement withPath() method.
|
||||
}
|
||||
|
||||
public function withQuery($query)
|
||||
{
|
||||
// TODO: Implement withQuery() method.
|
||||
}
|
||||
|
||||
public function withFragment($fragment)
|
||||
{
|
||||
// TODO: Implement withFragment() method.
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
// TODO: Implement __toString() method.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user