Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -10,6 +10,7 @@ use Psr\Http\Message\UriInterface;
class S3UriParser
{
private $pattern = '/^(.+\\.)?s3[.-]([A-Za-z0-9-]+)\\./';
private $streamWrapperScheme = 's3';
private static $defaultResult = [
'path_style' => true,
@@ -19,7 +20,8 @@ class S3UriParser
];
/**
* Parses a URL into an associative array of Amazon S3 data including:
* Parses a URL or S3 StreamWrapper Uri (s3://) into an associative array
* of Amazon S3 data including:
*
* - bucket: The Amazon S3 bucket (null if none)
* - key: The Amazon S3 key (null if none)
@@ -34,6 +36,11 @@ class S3UriParser
public function parse($uri)
{
$url = Psr7\uri_for($uri);
if ($url->getScheme() == $this->streamWrapperScheme) {
return $this->parseStreamWrapper($url);
}
if (!$url->getHost()) {
throw new \InvalidArgumentException('No hostname found in URI: '
. $uri);
@@ -54,9 +61,25 @@ class S3UriParser
return $result;
}
private function parseStreamWrapper(UriInterface $url)
{
$result = self::$defaultResult;
$result['path_style'] = false;
$result['bucket'] = $url->getHost();
if ($url->getPath()) {
$key = ltrim($url->getPath(), '/ ');
if (!empty($key)) {
$result['key'] = $key;
}
}
return $result;
}
private function parseCustomEndpoint(UriInterface $url)
{
$result = $result = self::$defaultResult;
$result = self::$defaultResult;
$path = ltrim($url->getPath(), '/ ');
$segments = explode('/', $path, 2);