for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of Spiral Framework package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Spiral\Distribution\Internal;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
class AmazonUriFactory implements UriFactoryInterface
{
* @var string
private const ERROR_NOT_AVAILABLE =
'The "aws/aws-sdk-php" package is supplied with the Guzzle PSR-7 ' .
'implementation, but it is not available. Please install the ' .
'"aws/aws-sdk-php" package or use any other implementation of PSR-17 factories.'
;
* AmazonUriFactory constructor.
public function __construct()
$this->assertAvailable();
}
* @param string $uri
* @return UriInterface
public function createUri(string $uri = ''): UriInterface
return new Uri($uri);
* @return void
private function assertAvailable(): void
if (\class_exists(Uri::class)) {
return;
throw new \DomainException(self::ERROR_NOT_AVAILABLE);