update
This commit is contained in:
@@ -15,10 +15,9 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"clue/stream-filter": "^1.5",
|
||||
"php-http/message-factory": "^1.0.2",
|
||||
"psr/http-message": "^1.0 || ^2.0"
|
||||
"psr/http-message": "^1.1 || ^2.0"
|
||||
},
|
||||
"provide": {
|
||||
"php-http/message-factory-implementation": "1.0"
|
||||
@@ -26,10 +25,11 @@
|
||||
"require-dev": {
|
||||
"ext-zlib": "*",
|
||||
"ergebnis/composer-normalize": "^2.6",
|
||||
"guzzlehttp/psr7": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.0 || ^2.0",
|
||||
"php-http/message-factory": "^1.0.2",
|
||||
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
|
||||
"slim/slim": "^3.0",
|
||||
"laminas/laminas-diactoros": "^2.0"
|
||||
"laminas/laminas-diactoros": "^2.0 || ^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zlib": "Used with compressor/decompressor streams",
|
||||
|
||||
@@ -27,9 +27,6 @@ final class AutoBasicAuth implements Authentication
|
||||
$this->shouldRemoveUserInfo = (bool) $shouldRremoveUserInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$uri = $request->getUri();
|
||||
|
||||
@@ -32,9 +32,6 @@ final class BasicAuth implements Authentication
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$header = sprintf('Basic %s', base64_encode(sprintf('%s:%s', $this->username, $this->password)));
|
||||
|
||||
@@ -25,9 +25,6 @@ final class Bearer implements Authentication
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$header = sprintf('Bearer %s', $this->token);
|
||||
|
||||
@@ -33,9 +33,6 @@ final class Chain implements Authentication
|
||||
$this->authenticationChain = $authenticationChain;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
foreach ($this->authenticationChain as $authentication) {
|
||||
|
||||
@@ -26,9 +26,6 @@ class Header implements Authentication
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
return $request->withHeader($this->name, $this->value);
|
||||
|
||||
@@ -27,7 +27,7 @@ final class Matching implements Authentication
|
||||
*/
|
||||
private $matcher;
|
||||
|
||||
public function __construct(Authentication $authentication, callable $matcher = null)
|
||||
public function __construct(Authentication $authentication, ?callable $matcher = null)
|
||||
{
|
||||
if (is_null($matcher)) {
|
||||
$matcher = function () {
|
||||
@@ -39,9 +39,6 @@ final class Matching implements Authentication
|
||||
$this->matcher = new CallbackRequestMatcher($matcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
if ($this->matcher->matches($request)) {
|
||||
|
||||
@@ -25,9 +25,6 @@ final class QueryParam implements Authentication
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$uri = $request->getUri();
|
||||
|
||||
@@ -29,9 +29,6 @@ final class RequestConditional implements Authentication
|
||||
$this->authentication = $authentication;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
if ($this->requestMatcher->matches($request)) {
|
||||
|
||||
@@ -42,9 +42,6 @@ final class Wsse implements Authentication
|
||||
$this->hashAlgorithm = $hashAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authenticate(RequestInterface $request)
|
||||
{
|
||||
$nonce = substr(md5(uniqid(uniqid().'_', true)), 0, 16);
|
||||
|
||||
@@ -73,7 +73,7 @@ final class Cookie
|
||||
$path = null,
|
||||
$secure = false,
|
||||
$httpOnly = false,
|
||||
\DateTime $expires = null
|
||||
?\DateTime $expires = null
|
||||
) {
|
||||
$this->validateName($name);
|
||||
$this->validateValue($value);
|
||||
@@ -109,7 +109,7 @@ final class Cookie
|
||||
$path = null,
|
||||
$secure = false,
|
||||
$httpOnly = false,
|
||||
\DateTime $expires = null
|
||||
?\DateTime $expires = null
|
||||
) {
|
||||
$cookie = new self('name', null, null, $domain, $path, $secure, $httpOnly, $expires);
|
||||
$cookie->name = $name;
|
||||
@@ -228,7 +228,7 @@ final class Cookie
|
||||
*
|
||||
* @return Cookie
|
||||
*/
|
||||
public function withExpires(\DateTime $expires = null)
|
||||
public function withExpires(?\DateTime $expires = null)
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->expires = $expires;
|
||||
@@ -511,7 +511,9 @@ final class Cookie
|
||||
*/
|
||||
private function normalizePath($path)
|
||||
{
|
||||
$path = rtrim($path, '/');
|
||||
if (null !== $path) {
|
||||
$path = rtrim($path, '/');
|
||||
}
|
||||
|
||||
if (empty($path) or '/' !== substr($path, 0, 1)) {
|
||||
$path = '/';
|
||||
|
||||
@@ -192,18 +192,12 @@ final class CookieJar implements \Countable, \IteratorAggregate
|
||||
$this->cookies = new \SplObjectStorage();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return $this->cookies->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
|
||||
@@ -20,26 +20,18 @@ trait MessageDecorator
|
||||
*
|
||||
* Since the underlying Message is immutable as well
|
||||
* exposing it is not an issue, because it's state cannot be altered
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function getMessage()
|
||||
public function getMessage(): MessageInterface
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProtocolVersion()
|
||||
public function getProtocolVersion(): string
|
||||
{
|
||||
return $this->message->getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withProtocolVersion($version)
|
||||
public function withProtocolVersion(string $version): MessageInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withProtocolVersion($version);
|
||||
@@ -47,42 +39,27 @@ trait MessageDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return $this->message->getHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasHeader($header)
|
||||
public function hasHeader(string $header): bool
|
||||
{
|
||||
return $this->message->hasHeader($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeader($header)
|
||||
public function getHeader(string $header): array
|
||||
{
|
||||
return $this->message->getHeader($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeaderLine($header)
|
||||
public function getHeaderLine(string $header): string
|
||||
{
|
||||
return $this->message->getHeaderLine($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withHeader($header, $value)
|
||||
public function withHeader(string $header, $value): MessageInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withHeader($header, $value);
|
||||
@@ -90,10 +67,7 @@ trait MessageDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withAddedHeader($header, $value)
|
||||
public function withAddedHeader(string $header, $value): MessageInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withAddedHeader($header, $value);
|
||||
@@ -101,10 +75,7 @@ trait MessageDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withoutHeader($header)
|
||||
public function withoutHeader(string $header): MessageInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withoutHeader($header);
|
||||
@@ -112,18 +83,12 @@ trait MessageDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBody()
|
||||
public function getBody(): StreamInterface
|
||||
{
|
||||
return $this->message->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withBody(StreamInterface $body)
|
||||
public function withBody(StreamInterface $body): MessageInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withBody($body);
|
||||
|
||||
@@ -16,10 +16,8 @@ trait RequestDecorator
|
||||
|
||||
/**
|
||||
* Exchanges the underlying request with another.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function withRequest(RequestInterface $request)
|
||||
public function withRequest(RequestInterface $request): RequestInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $request;
|
||||
@@ -27,18 +25,12 @@ trait RequestDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequestTarget()
|
||||
public function getRequestTarget(): string
|
||||
{
|
||||
return $this->message->getRequestTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withRequestTarget($requestTarget)
|
||||
public function withRequestTarget(string $requestTarget): RequestInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withRequestTarget($requestTarget);
|
||||
@@ -46,18 +38,12 @@ trait RequestDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMethod()
|
||||
public function getMethod(): string
|
||||
{
|
||||
return $this->message->getMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withMethod($method)
|
||||
public function withMethod(string $method): RequestInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withMethod($method);
|
||||
@@ -65,18 +51,12 @@ trait RequestDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUri()
|
||||
public function getUri(): UriInterface
|
||||
{
|
||||
return $this->message->getUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withUri(UriInterface $uri, $preserveHost = false)
|
||||
public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withUri($uri, $preserveHost);
|
||||
|
||||
@@ -15,10 +15,8 @@ trait ResponseDecorator
|
||||
|
||||
/**
|
||||
* Exchanges the underlying response with another.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function withResponse(ResponseInterface $response)
|
||||
public function withResponse(ResponseInterface $response): ResponseInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $response;
|
||||
@@ -26,18 +24,12 @@ trait ResponseDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStatusCode()
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return $this->message->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function withStatus($code, $reasonPhrase = '')
|
||||
public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface
|
||||
{
|
||||
$new = clone $this;
|
||||
$new->message = $this->message->withStatus($code, $reasonPhrase);
|
||||
@@ -45,10 +37,7 @@ trait ResponseDecorator
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReasonPhrase()
|
||||
public function getReasonPhrase(): string
|
||||
{
|
||||
return $this->message->getReasonPhrase();
|
||||
}
|
||||
|
||||
@@ -16,122 +16,77 @@ trait StreamDecorator
|
||||
*/
|
||||
protected $stream;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->stream->__toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
public function close(): void
|
||||
{
|
||||
$this->stream->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function detach()
|
||||
{
|
||||
return $this->stream->detach();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSize()
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return $this->stream->getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function tell()
|
||||
public function tell(): int
|
||||
{
|
||||
return $this->stream->tell();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function eof()
|
||||
public function eof(): bool
|
||||
{
|
||||
return $this->stream->eof();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSeekable()
|
||||
public function isSeekable(): bool
|
||||
{
|
||||
return $this->stream->isSeekable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function seek($offset, $whence = SEEK_SET)
|
||||
public function seek(int $offset, int $whence = SEEK_SET): void
|
||||
{
|
||||
$this->stream->seek($offset, $whence);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->stream->rewind();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable()
|
||||
public function isWritable(): bool
|
||||
{
|
||||
return $this->stream->isWritable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($string)
|
||||
public function write(string $string): int
|
||||
{
|
||||
return $this->stream->write($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable()
|
||||
public function isReadable(): bool
|
||||
{
|
||||
return $this->stream->isReadable();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($length)
|
||||
public function read(int $length): string
|
||||
{
|
||||
return $this->stream->read($length);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContents()
|
||||
public function getContents(): string
|
||||
{
|
||||
return $this->stream->getContents();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
public function getMetadata(?string $key = null)
|
||||
{
|
||||
return $this->stream->getMetadata($key);
|
||||
}
|
||||
|
||||
@@ -9,26 +9,17 @@ namespace Http\Message\Encoding;
|
||||
*/
|
||||
class ChunkStream extends FilteredStream
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'chunk';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'dechunk';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function fill()
|
||||
protected function fill(): void
|
||||
{
|
||||
parent::fill();
|
||||
|
||||
|
||||
@@ -27,18 +27,12 @@ class CompressStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
@@ -11,18 +11,12 @@ namespace Http\Message\Encoding;
|
||||
*/
|
||||
class DechunkStream extends FilteredStream
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'dechunk';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'chunk';
|
||||
}
|
||||
|
||||
@@ -27,18 +27,12 @@ class DecompressStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15, 'level' => $level]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
@@ -23,18 +23,12 @@ class DeflateStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ namespace Http\Message\Encoding\Filter;
|
||||
*/
|
||||
class Chunk extends \php_user_filter
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function filter($in, $out, &$consumed, $closing)
|
||||
public function filter($in, $out, &$consumed, $closing): int
|
||||
{
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
$lenbucket = stream_bucket_new($this->stream, dechex($bucket->datalen)."\r\n");
|
||||
|
||||
@@ -75,10 +75,7 @@ abstract class FilteredStream implements StreamInterface
|
||||
$this->stream = $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($length)
|
||||
public function read(int $length): string
|
||||
{
|
||||
if (strlen($this->buffer) >= $length) {
|
||||
$read = substr($this->buffer, 0, $length);
|
||||
@@ -101,10 +98,7 @@ abstract class FilteredStream implements StreamInterface
|
||||
return $read.$this->read($length - strlen($read));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function eof()
|
||||
public function eof(): bool
|
||||
{
|
||||
return $this->stream->eof() && '' === $this->buffer;
|
||||
}
|
||||
@@ -116,7 +110,7 @@ abstract class FilteredStream implements StreamInterface
|
||||
* This allow to get last data in the PHP buffer otherwise this
|
||||
* bug is present : https://bugs.php.net/bug.php?id=48725
|
||||
*/
|
||||
protected function fill()
|
||||
protected function fill(): void
|
||||
{
|
||||
$readFilterCallback = $this->readFilterCallback;
|
||||
$this->buffer .= $readFilterCallback($this->stream->read(self::BUFFER_SIZE));
|
||||
@@ -126,10 +120,7 @@ abstract class FilteredStream implements StreamInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContents()
|
||||
public function getContents(): string
|
||||
{
|
||||
$buffer = '';
|
||||
|
||||
@@ -149,15 +140,12 @@ abstract class FilteredStream implements StreamInterface
|
||||
/**
|
||||
* Always returns null because we can't tell the size of a stream when we filter.
|
||||
*/
|
||||
public function getSize()
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getContents();
|
||||
}
|
||||
@@ -167,24 +155,24 @@ abstract class FilteredStream implements StreamInterface
|
||||
*
|
||||
* We would need to buffer and process everything to allow seeking.
|
||||
*/
|
||||
public function isSeekable()
|
||||
public function isSeekable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Filtered streams are not seekable and can thus not be rewound.
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
@trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED);
|
||||
$this->doRewind();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Filtered streams are not seekable.
|
||||
*/
|
||||
public function seek($offset, $whence = SEEK_SET)
|
||||
public function seek(int $offset, int $whence = SEEK_SET): void
|
||||
{
|
||||
@trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED);
|
||||
$this->doSeek($offset, $whence);
|
||||
@@ -193,11 +181,9 @@ abstract class FilteredStream implements StreamInterface
|
||||
/**
|
||||
* Returns the read filter name.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated since version 1.5, will be removed in 2.0
|
||||
*/
|
||||
public function getReadFilter()
|
||||
public function getReadFilter(): string
|
||||
{
|
||||
@trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
|
||||
|
||||
@@ -206,19 +192,15 @@ abstract class FilteredStream implements StreamInterface
|
||||
|
||||
/**
|
||||
* Returns the write filter name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function readFilter();
|
||||
abstract protected function readFilter(): string;
|
||||
|
||||
/**
|
||||
* Returns the write filter name.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated since version 1.5, will be removed in 2.0
|
||||
*/
|
||||
public function getWriteFilter()
|
||||
public function getWriteFilter(): string
|
||||
{
|
||||
@trigger_error('The '.__CLASS__.'::'.__METHOD__.' method is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
|
||||
|
||||
@@ -227,8 +209,6 @@ abstract class FilteredStream implements StreamInterface
|
||||
|
||||
/**
|
||||
* Returns the write filter name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function writeFilter();
|
||||
abstract protected function writeFilter(): string;
|
||||
}
|
||||
|
||||
@@ -27,18 +27,12 @@ class GzipDecodeStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31, 'level' => $level]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
@@ -27,18 +27,12 @@ class GzipEncodeStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
@@ -27,18 +27,12 @@ class InflateStream extends FilteredStream
|
||||
$this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15, 'level' => $level]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function readFilter()
|
||||
protected function readFilter(): string
|
||||
{
|
||||
return 'zlib.inflate';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function writeFilter()
|
||||
protected function writeFilter(): string
|
||||
{
|
||||
return 'zlib.deflate';
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ use Psr\Http\Message\ResponseInterface;
|
||||
*/
|
||||
class CurlCommandFormatter implements Formatter
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatRequest(RequestInterface $request)
|
||||
{
|
||||
$command = sprintf('curl %s', escapeshellarg((string) $request->getUri()->withFragment('')));
|
||||
@@ -60,9 +57,6 @@ class CurlCommandFormatter implements Formatter
|
||||
return $command;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatResponse(ResponseInterface $response)
|
||||
{
|
||||
return '';
|
||||
|
||||
@@ -36,9 +36,6 @@ class FullHttpMessageFormatter implements Formatter
|
||||
$this->binaryDetectionRegex = $binaryDetectionRegex;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatRequest(RequestInterface $request)
|
||||
{
|
||||
$message = sprintf(
|
||||
@@ -55,9 +52,6 @@ class FullHttpMessageFormatter implements Formatter
|
||||
return $this->addBody($request, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatResponse(ResponseInterface $response)
|
||||
{
|
||||
$message = sprintf(
|
||||
|
||||
@@ -14,9 +14,6 @@ use Psr\Http\Message\ResponseInterface;
|
||||
*/
|
||||
class SimpleFormatter implements Formatter
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatRequest(RequestInterface $request)
|
||||
{
|
||||
return sprintf(
|
||||
@@ -27,9 +24,6 @@ class SimpleFormatter implements Formatter
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatResponse(ResponseInterface $response)
|
||||
{
|
||||
return sprintf(
|
||||
|
||||
@@ -9,6 +9,10 @@ use Laminas\Diactoros\Response as LaminasResponse;
|
||||
use Zend\Diactoros\Request as ZendRequest;
|
||||
use Zend\Diactoros\Response as ZendResponse;
|
||||
|
||||
if (!interface_exists(MessageFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Diactoros messages.
|
||||
*
|
||||
@@ -28,9 +32,6 @@ final class DiactorosMessageFactory implements MessageFactory
|
||||
$this->streamFactory = new DiactorosStreamFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createRequest(
|
||||
$method,
|
||||
$uri,
|
||||
@@ -55,9 +56,6 @@ final class DiactorosMessageFactory implements MessageFactory
|
||||
))->withProtocolVersion($protocolVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createResponse(
|
||||
$statusCode = 200,
|
||||
$reasonPhrase = null,
|
||||
|
||||
@@ -6,6 +6,10 @@ use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Http\Message\MessageFactory;
|
||||
|
||||
if (!interface_exists(MessageFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Guzzle messages.
|
||||
*
|
||||
@@ -15,9 +19,6 @@ use Http\Message\MessageFactory;
|
||||
*/
|
||||
final class GuzzleMessageFactory implements MessageFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createRequest(
|
||||
$method,
|
||||
$uri,
|
||||
@@ -34,9 +35,6 @@ final class GuzzleMessageFactory implements MessageFactory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createResponse(
|
||||
$statusCode = 200,
|
||||
$reasonPhrase = null,
|
||||
|
||||
@@ -9,6 +9,10 @@ use Slim\Http\Headers;
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
||||
if (!interface_exists(MessageFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Slim 3 messages.
|
||||
*
|
||||
@@ -34,9 +38,6 @@ final class SlimMessageFactory implements MessageFactory
|
||||
$this->uriFactory = new SlimUriFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createRequest(
|
||||
$method,
|
||||
$uri,
|
||||
@@ -55,9 +56,6 @@ final class SlimMessageFactory implements MessageFactory
|
||||
))->withProtocolVersion($protocolVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createResponse(
|
||||
$statusCode = 200,
|
||||
$reasonPhrase = null,
|
||||
|
||||
@@ -22,9 +22,6 @@ final class CallbackRequestMatcher implements RequestMatcher
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function matches(RequestInterface $request)
|
||||
{
|
||||
return (bool) call_user_func($this->callback, $request);
|
||||
|
||||
@@ -31,9 +31,6 @@ final class RegexRequestMatcher implements RequestMatcher
|
||||
$this->regex = $regex;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function matches(RequestInterface $request)
|
||||
{
|
||||
return (bool) preg_match($this->regex, (string) $request->getUri());
|
||||
|
||||
@@ -51,8 +51,6 @@ final class RequestMatcher implements RequestMatcherInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function matches(RequestInterface $request)
|
||||
|
||||
@@ -17,7 +17,7 @@ class BufferedStream implements StreamInterface
|
||||
/** @var resource The buffered resource used to seek previous data */
|
||||
private $resource;
|
||||
|
||||
/** @var int size of the stream if available */
|
||||
/** @var int|null size of the stream if available */
|
||||
private $size;
|
||||
|
||||
/** @var StreamInterface The underlying stream decorated by this class */
|
||||
@@ -49,10 +49,7 @@ class BufferedStream implements StreamInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
try {
|
||||
$this->rewind();
|
||||
@@ -60,15 +57,10 @@ class BufferedStream implements StreamInterface
|
||||
return $this->getContents();
|
||||
} catch (\Throwable $throwable) {
|
||||
return '';
|
||||
} catch (\Exception $exception) { // Layer to be BC with PHP 5, remove this when we only support PHP 7+
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
public function close(): void
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot close on a detached stream');
|
||||
@@ -78,13 +70,10 @@ class BufferedStream implements StreamInterface
|
||||
fclose($this->resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function detach()
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Force reading the remaining data of the stream
|
||||
@@ -98,13 +87,10 @@ class BufferedStream implements StreamInterface
|
||||
return $resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSize()
|
||||
public function getSize(): ?int
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (null === $this->size && $this->stream->eof()) {
|
||||
@@ -114,22 +100,21 @@ class BufferedStream implements StreamInterface
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function tell()
|
||||
public function tell(): int
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot tell on a detached stream');
|
||||
}
|
||||
|
||||
return ftell($this->resource);
|
||||
$tell = ftell($this->resource);
|
||||
if (false === $tell) {
|
||||
throw new \RuntimeException('ftell failed');
|
||||
}
|
||||
|
||||
return $tell;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function eof()
|
||||
public function eof(): bool
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot call eof on a detached stream');
|
||||
@@ -139,18 +124,12 @@ class BufferedStream implements StreamInterface
|
||||
return $this->stream->eof() && (ftell($this->resource) === $this->written);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isSeekable()
|
||||
public function isSeekable(): bool
|
||||
{
|
||||
return null !== $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function seek($offset, $whence = SEEK_SET)
|
||||
public function seek(int $offset, int $whence = SEEK_SET): void
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot seek on a detached stream');
|
||||
@@ -159,10 +138,7 @@ class BufferedStream implements StreamInterface
|
||||
fseek($this->resource, $offset, $whence);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot rewind on a detached stream');
|
||||
@@ -171,34 +147,22 @@ class BufferedStream implements StreamInterface
|
||||
rewind($this->resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable()
|
||||
public function isWritable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($string)
|
||||
public function write(string $string): int
|
||||
{
|
||||
throw new \RuntimeException('Cannot write on this stream');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable()
|
||||
public function isReadable(): bool
|
||||
{
|
||||
return null !== $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($length)
|
||||
public function read(int $length): string
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot read on a detached stream');
|
||||
@@ -206,6 +170,9 @@ class BufferedStream implements StreamInterface
|
||||
if ($length < 0) {
|
||||
throw new \InvalidArgumentException('Can not read a negative amount of bytes');
|
||||
}
|
||||
if (0 === $length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$read = '';
|
||||
|
||||
@@ -213,6 +180,9 @@ class BufferedStream implements StreamInterface
|
||||
if (ftell($this->resource) !== $this->written) {
|
||||
$read = fread($this->resource, $length);
|
||||
}
|
||||
if (false === $read) {
|
||||
throw new \RuntimeException('Failed to read from resource');
|
||||
}
|
||||
|
||||
$bytesRead = strlen($read);
|
||||
|
||||
@@ -227,10 +197,7 @@ class BufferedStream implements StreamInterface
|
||||
return $read;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContents()
|
||||
public function getContents(): string
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
throw new \RuntimeException('Cannot read on a detached stream');
|
||||
@@ -245,17 +212,14 @@ class BufferedStream implements StreamInterface
|
||||
return $read;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
public function getMetadata(?string $key = null)
|
||||
{
|
||||
if (null === $this->resource) {
|
||||
if (null === $key) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$metadata = stream_get_meta_data($this->resource);
|
||||
@@ -265,7 +229,7 @@ class BufferedStream implements StreamInterface
|
||||
}
|
||||
|
||||
if (!array_key_exists($key, $metadata)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $metadata[$key];
|
||||
|
||||
@@ -7,6 +7,10 @@ use Laminas\Diactoros\Stream as LaminasStream;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Zend\Diactoros\Stream as ZendStream;
|
||||
|
||||
if (!interface_exists(StreamFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Diactoros streams.
|
||||
*
|
||||
@@ -16,9 +20,6 @@ use Zend\Diactoros\Stream as ZendStream;
|
||||
*/
|
||||
final class DiactorosStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
if ($body instanceof StreamInterface) {
|
||||
|
||||
@@ -5,6 +5,10 @@ namespace Http\Message\StreamFactory;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
use Http\Message\StreamFactory;
|
||||
|
||||
if (!interface_exists(StreamFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Guzzle streams.
|
||||
*
|
||||
@@ -14,15 +18,13 @@ use Http\Message\StreamFactory;
|
||||
*/
|
||||
final class GuzzleStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
if (class_exists(Utils::class)) {
|
||||
return Utils::streamFor($body);
|
||||
}
|
||||
|
||||
// legacy support for guzzle/psr7 1.*
|
||||
return \GuzzleHttp\Psr7\stream_for($body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ use Http\Message\StreamFactory;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Slim\Http\Stream;
|
||||
|
||||
if (!interface_exists(StreamFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimStreamFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Slim 3 streams.
|
||||
*
|
||||
@@ -15,9 +19,6 @@ use Slim\Http\Stream;
|
||||
*/
|
||||
final class SlimStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
if ($body instanceof StreamInterface) {
|
||||
|
||||
@@ -7,6 +7,10 @@ use Laminas\Diactoros\Uri as LaminasUri;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Zend\Diactoros\Uri as ZendUri;
|
||||
|
||||
if (!interface_exists(UriFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\DiactorosUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Diactoros URI.
|
||||
*
|
||||
@@ -16,9 +20,6 @@ use Zend\Diactoros\Uri as ZendUri;
|
||||
*/
|
||||
final class DiactorosUriFactory implements UriFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createUri($uri)
|
||||
{
|
||||
if ($uri instanceof UriInterface) {
|
||||
|
||||
@@ -7,6 +7,10 @@ use Http\Message\UriFactory;
|
||||
|
||||
use function GuzzleHttp\Psr7\uri_for;
|
||||
|
||||
if (!interface_exists(UriFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\GuzzleUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Guzzle URI.
|
||||
*
|
||||
@@ -16,9 +20,6 @@ use function GuzzleHttp\Psr7\uri_for;
|
||||
*/
|
||||
final class GuzzleUriFactory implements UriFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createUri($uri)
|
||||
{
|
||||
if (class_exists(Utils::class)) {
|
||||
|
||||
@@ -6,6 +6,10 @@ use Http\Message\UriFactory;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Slim\Http\Uri;
|
||||
|
||||
if (!interface_exists(UriFactory::class)) {
|
||||
throw new \LogicException('You cannot use "Http\Message\MessageFactory\SlimUriFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Slim 3 URI.
|
||||
*
|
||||
@@ -15,9 +19,6 @@ use Slim\Http\Uri;
|
||||
*/
|
||||
final class SlimUriFactory implements UriFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createUri($uri)
|
||||
{
|
||||
if ($uri instanceof UriInterface) {
|
||||
|
||||
Reference in New Issue
Block a user