version 1.5

This commit is contained in:
Johannes Holzwarth | SE-Inno GmbH
2024-01-11 14:04:25 +01:00
parent 0ee8291846
commit 4492763b78
756 changed files with 209957 additions and 2 deletions
@@ -0,0 +1,40 @@
<?php
namespace Http\Message\UriFactory;
use Http\Message\UriFactory;
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.
*
* @author David de Boer <david@ddeboer.nl>
*
* @deprecated This will be removed in php-http/message2.0. Consider using the official Diactoros PSR-17 factory
*/
final class DiactorosUriFactory implements UriFactory
{
/**
* {@inheritdoc}
*/
public function createUri($uri)
{
if ($uri instanceof UriInterface) {
return $uri;
} elseif (is_string($uri)) {
if (class_exists(LaminasUri::class)) {
return new LaminasUri($uri);
}
return new ZendUri($uri);
}
throw new \InvalidArgumentException('URI must be a string or UriInterface');
}
}
@@ -0,0 +1,34 @@
<?php
namespace Http\Message\UriFactory;
use GuzzleHttp\Psr7\Utils;
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.
*
* @author David de Boer <david@ddeboer.nl>
*
* @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory
*/
final class GuzzleUriFactory implements UriFactory
{
/**
* {@inheritdoc}
*/
public function createUri($uri)
{
if (class_exists(Utils::class)) {
return Utils::uriFor($uri);
}
return uri_for($uri);
}
}
@@ -0,0 +1,37 @@
<?php
namespace Http\Message\UriFactory;
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.
*
* @author Mika Tuupola <tuupola@appelsiini.net>
*
* @deprecated This will be removed in php-http/message2.0. Consider using the official Slim PSR-17 factory
*/
final class SlimUriFactory implements UriFactory
{
/**
* {@inheritdoc}
*/
public function createUri($uri)
{
if ($uri instanceof UriInterface) {
return $uri;
}
if (is_string($uri)) {
return Uri::createFromString($uri);
}
throw new \InvalidArgumentException('URI must be a string or UriInterface');
}
}