aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/uri
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/uri
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/uri')
-rw-r--r--vendor/sabre/uri/.gitattributes4
-rw-r--r--vendor/sabre/uri/.gitignore6
-rw-r--r--vendor/sabre/uri/.php_cs.dist12
-rw-r--r--vendor/sabre/uri/.travis.yml14
-rw-r--r--vendor/sabre/uri/CHANGELOG.md57
-rw-r--r--vendor/sabre/uri/LICENSE2
-rw-r--r--vendor/sabre/uri/README.md47
-rw-r--r--vendor/sabre/uri/composer.json10
-rw-r--r--vendor/sabre/uri/lib/InvalidUriException.php8
-rw-r--r--vendor/sabre/uri/lib/Version.php11
-rw-r--r--vendor/sabre/uri/lib/functions.php180
-rw-r--r--vendor/sabre/uri/phpstan.neon3
12 files changed, 142 insertions, 212 deletions
diff --git a/vendor/sabre/uri/.gitattributes b/vendor/sabre/uri/.gitattributes
new file mode 100644
index 000000000..d1618f3a1
--- /dev/null
+++ b/vendor/sabre/uri/.gitattributes
@@ -0,0 +1,4 @@
+/tests export-ignore
+/.travis.yml export-ignore
+/CHANGELOG.md export-ignore
+/README.md export-ignore
diff --git a/vendor/sabre/uri/.gitignore b/vendor/sabre/uri/.gitignore
index 19d1affd4..b6fc3f896 100644
--- a/vendor/sabre/uri/.gitignore
+++ b/vendor/sabre/uri/.gitignore
@@ -6,8 +6,10 @@ composer.lock
tests/cov/
# Composer binaries
-bin/phpunit
-bin/phpcs
+bin
# Vim
.*.swp
+
+# development stuff
+.php_cs.cache
diff --git a/vendor/sabre/uri/.php_cs.dist b/vendor/sabre/uri/.php_cs.dist
new file mode 100644
index 000000000..8d61ee259
--- /dev/null
+++ b/vendor/sabre/uri/.php_cs.dist
@@ -0,0 +1,12 @@
+<?php
+
+$config = PhpCsFixer\Config::create();
+$config->getFinder()
+ ->exclude('vendor')
+ ->in(__DIR__);
+$config->setRules([
+ '@PSR1' => true,
+ '@Symfony' =>true
+]);
+
+return $config; \ No newline at end of file
diff --git a/vendor/sabre/uri/.travis.yml b/vendor/sabre/uri/.travis.yml
deleted file mode 100644
index 75c8270df..000000000
--- a/vendor/sabre/uri/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-language: php
-php:
- - 5.4
- - 5.5
- - 5.6
- - 7
- - 7.1
-
-script:
- - ./bin/phpunit --configuration tests/phpunit.xml.dist
- - ./bin/sabre-cs-fixer fix lib/ --dry-run --diff
-
-before_script: composer install --dev
-
diff --git a/vendor/sabre/uri/CHANGELOG.md b/vendor/sabre/uri/CHANGELOG.md
deleted file mode 100644
index 92aaa7507..000000000
--- a/vendor/sabre/uri/CHANGELOG.md
+++ /dev/null
@@ -1,57 +0,0 @@
-ChangeLog
-=========
-
-1.2.1 (2017-02-20)
-------------------
-
-* #16: Correctly parse urls that are only a fragment `#`.
-
-
-1.2.0 (2016-12-06)
-------------------
-
-* Now throwing `InvalidUriException` if a uri passed to the `parse` function
- is invalid or could not be parsed.
-* #11: Fix support for URIs that start with a triple slash. PHP's `parse_uri()`
- doesn't support them, so we now have a pure-php fallback in case it fails.
-* #9: Fix support for relative URI's that have a non-uri encoded colon `:` in
- them.
-
-
-1.1.1 (2016-10-27)
-------------------
-
-* #10: Correctly support file:// URIs in the build() method. (@yuloh)
-
-
-1.1.0 (2016-03-07)
-------------------
-
-* #6: PHP's `parse_url()` corrupts strings if they contain certain
- non ascii-characters such as Chinese or Hebrew. sabre/uri's `parse()`
- function now percent-encodes these characters beforehand.
-
-
-1.0.1 (2015-04-28)
-------------------
-
-* #4: Using php-cs-fixer to automatically enforce conding standards.
-* #5: Resolving to and building `mailto:` urls were not correctly handled.
-
-
-1.0.0 (2015-01-27)
-------------------
-
-* Added a `normalize` function.
-* Added a `buildUri` function.
-* Fixed a bug in the `resolve` when only a new fragment is specified.
-
-San José, CalConnect XXXII release!
-
-0.0.1 (2014-11-17)
-------------------
-
-* First version!
-* Source was lifted from sabre/http package.
-* Provides a `resolve` and a `split` function.
-* Requires PHP 5.4.8 and up.
diff --git a/vendor/sabre/uri/LICENSE b/vendor/sabre/uri/LICENSE
index 087996be7..ae2c99290 100644
--- a/vendor/sabre/uri/LICENSE
+++ b/vendor/sabre/uri/LICENSE
@@ -1,4 +1,4 @@
-Copyright (C) 2014-2017 fruux GmbH (https://fruux.com/)
+Copyright (C) 2014-2019 fruux GmbH (https://fruux.com/)
All rights reserved.
diff --git a/vendor/sabre/uri/README.md b/vendor/sabre/uri/README.md
deleted file mode 100644
index aa21bfe06..000000000
--- a/vendor/sabre/uri/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-sabre/uri
-=========
-
-sabre/uri is a lightweight library that provides several functions for working
-with URIs, staying true to the rules of [RFC3986][2].
-
-Partially inspired by [Node.js URL library][3], and created to solve real
-problems in PHP applications. 100% unitested and many tests are based on
-examples from RFC3986.
-
-The library provides the following functions:
-
-1. `resolve` to resolve relative urls.
-2. `normalize` to aid in comparing urls.
-3. `parse`, which works like PHP's [parse_url][6].
-4. `build` to do the exact opposite of `parse`.
-5. `split` to easily get the 'dirname' and 'basename' of a URL without all the
- problems those two functions have.
-
-
-Further reading
----------------
-
-* [Installation][7]
-* [Usage][8]
-
-
-Questions?
-----------
-
-Head over to the [sabre/dav mailinglist][4], or you can also just open a ticket
-on [GitHub][5].
-
-
-Made at fruux
--------------
-
-This library is being developed by [fruux](https://fruux.com/). Drop us a line for commercial services or enterprise support.
-
-[1]: http://sabre.io/uri/
-[2]: https://tools.ietf.org/html/rfc3986/
-[3]: http://nodejs.org/api/url.html
-[4]: http://groups.google.com/group/sabredav-discuss
-[5]: https://github.com/fruux/sabre-uri/issues/
-[6]: http://php.net/manual/en/function.parse-url.php
-[7]: http://sabre.io/uri/install/
-[8]: http://sabre.io/uri/usage/
diff --git a/vendor/sabre/uri/composer.json b/vendor/sabre/uri/composer.json
index 49d69e723..30f382937 100644
--- a/vendor/sabre/uri/composer.json
+++ b/vendor/sabre/uri/composer.json
@@ -9,7 +9,7 @@
"homepage": "http://sabre.io/uri/",
"license": "BSD-3-Clause",
"require": {
- "php": ">=5.4.7"
+ "php": ">=7"
},
"authors": [
{
@@ -31,9 +31,13 @@
"Sabre\\Uri\\" : "lib/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "Sabre\\Uri\\": "tests/"
+ }
+ },
"require-dev": {
- "sabre/cs": "~1.0.0",
- "phpunit/phpunit" : ">=4.0,<6.0"
+ "phpunit/phpunit" : "^6"
},
"config" : {
"bin-dir" : "bin/"
diff --git a/vendor/sabre/uri/lib/InvalidUriException.php b/vendor/sabre/uri/lib/InvalidUriException.php
index 0385fd462..7f37ca54e 100644
--- a/vendor/sabre/uri/lib/InvalidUriException.php
+++ b/vendor/sabre/uri/lib/InvalidUriException.php
@@ -1,9 +1,11 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\Uri;
/**
- * Invalid Uri
+ * Invalid Uri.
*
* This is thrown when an attempt was made to use Sabre\Uri parse a uri that
* it could not.
@@ -12,6 +14,6 @@ namespace Sabre\Uri;
* @author Evert Pot (https://evertpot.com/)
* @license http://sabre.io/license/
*/
-class InvalidUriException extends \Exception {
-
+class InvalidUriException extends \Exception
+{
}
diff --git a/vendor/sabre/uri/lib/Version.php b/vendor/sabre/uri/lib/Version.php
index fa544538b..ad6c89867 100644
--- a/vendor/sabre/uri/lib/Version.php
+++ b/vendor/sabre/uri/lib/Version.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\Uri;
/**
@@ -9,11 +11,10 @@ namespace Sabre\Uri;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/
*/
-class Version {
-
+class Version
+{
/**
- * Full version number
+ * Full version number.
*/
- const VERSION = '1.2.1';
-
+ const VERSION = '2.1.3';
}
diff --git a/vendor/sabre/uri/lib/functions.php b/vendor/sabre/uri/lib/functions.php
index 39b4a6f08..161e684d7 100644
--- a/vendor/sabre/uri/lib/functions.php
+++ b/vendor/sabre/uri/lib/functions.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\Uri;
/**
@@ -18,30 +20,32 @@ namespace Sabre\Uri;
*
* @param string $basePath
* @param string $newPath
+ *
* @return string
+ *
+ * @throws InvalidUriException
*/
-function resolve($basePath, $newPath) {
-
- $base = parse($basePath);
+function resolve(string $basePath, string $newPath): string
+{
$delta = parse($newPath);
- $pick = function($part) use ($base, $delta) {
+ // If the new path defines a scheme, it's absolute and we can just return
+ // that.
+ if ($delta['scheme']) {
+ return build($delta);
+ }
+ $base = parse($basePath);
+ $pick = function ($part) use ($base, $delta) {
if ($delta[$part]) {
return $delta[$part];
} elseif ($base[$part]) {
return $base[$part];
}
- return null;
+ return null;
};
- // If the new path defines a scheme, it's absolute and we can just return
- // that.
- if ($delta['scheme']) {
- return build($delta);
- }
-
$newParts = [];
$newParts['scheme'] = $pick('scheme');
@@ -49,17 +53,18 @@ function resolve($basePath, $newPath) {
$newParts['port'] = $pick('port');
$path = '';
- if ($delta['path']) {
+ if (is_string($delta['path']) and strlen($delta['path']) > 0) {
// If the path starts with a slash
- if ($delta['path'][0] === '/') {
+ if ('/' === $delta['path'][0]) {
$path = $delta['path'];
} else {
// Removing last component from base path.
$path = $base['path'];
- if (strpos($path, '/') !== false) {
- $path = substr($path, 0, strrpos($path, '/'));
+ $length = strrpos((string) $path, '/');
+ if (false !== $length) {
+ $path = substr($path, 0, $length);
}
- $path .= '/' . $delta['path'];
+ $path .= '/'.$delta['path'];
}
} else {
$path = $base['path'] ?: '/';
@@ -68,15 +73,14 @@ function resolve($basePath, $newPath) {
$pathParts = explode('/', $path);
$newPathParts = [];
foreach ($pathParts as $pathPart) {
-
switch ($pathPart) {
//case '' :
- case '.' :
+ case '.':
break;
- case '..' :
+ case '..':
array_pop($newPathParts);
break;
- default :
+ default:
$newPathParts[] = $pathPart;
break;
}
@@ -95,8 +99,8 @@ function resolve($basePath, $newPath) {
if ($delta['fragment']) {
$newParts['fragment'] = $delta['fragment'];
}
- return build($newParts);
+ return build($newParts);
}
/**
@@ -109,10 +113,13 @@ function resolve($basePath, $newPath) {
* It will also change a %3a into a %3A.
*
* @param string $uri
+ *
* @return string
+ *
+ * @throws InvalidUriException
*/
-function normalize($uri) {
-
+function normalize(string $uri): string
+{
$parts = parse($uri);
if (!empty($parts['path'])) {
@@ -123,23 +130,23 @@ function normalize($uri) {
case '.':
// skip
break;
- case '..' :
+ case '..':
// One level up in the hierarchy
array_pop($newPathParts);
break;
- default :
+ default:
// Ensuring that everything is correctly percent-encoded.
$newPathParts[] = rawurlencode(rawurldecode($pathPart));
break;
}
}
- $parts['path'] = '/' . implode('/', $newPathParts);
+ $parts['path'] = '/'.implode('/', $newPathParts);
}
if ($parts['scheme']) {
$parts['scheme'] = strtolower($parts['scheme']);
$defaultPorts = [
- 'http' => '80',
+ 'http' => '80',
'https' => '443',
];
@@ -149,8 +156,8 @@ function normalize($uri) {
}
// A few HTTP specific rules.
switch ($parts['scheme']) {
- case 'http' :
- case 'https' :
+ case 'http':
+ case 'https':
if (empty($parts['path'])) {
// An empty path is equivalent to / in http.
$parts['path'] = '/';
@@ -159,10 +166,11 @@ function normalize($uri) {
}
}
- if ($parts['host']) $parts['host'] = strtolower($parts['host']);
+ if ($parts['host']) {
+ $parts['host'] = strtolower($parts['host']);
+ }
return build($parts);
-
}
/**
@@ -176,10 +184,13 @@ function normalize($uri) {
* percent-encoded strings. PHP's parse_url corrupts these characters on OS X.
*
* @param string $uri
+ *
* @return array
+ *
+ * @throws InvalidUriException
*/
-function parse($uri) {
-
+function parse(string $uri): array
+{
// Normally a URI must be ASCII, however. However, often it's not and
// parse_url might corrupt these strings.
//
@@ -187,7 +198,7 @@ function parse($uri) {
// uriencode them first.
$uri = preg_replace_callback(
'/[^[:ascii:]]/u',
- function($matches) {
+ function ($matches) {
return rawurlencode($matches[0]);
},
$uri
@@ -200,15 +211,14 @@ function parse($uri) {
return
$result + [
- 'scheme' => null,
- 'host' => null,
- 'path' => null,
- 'port' => null,
- 'user' => null,
- 'query' => null,
+ 'scheme' => null,
+ 'host' => null,
+ 'path' => null,
+ 'port' => null,
+ 'user' => null,
+ 'query' => null,
'fragment' => null,
];
-
}
/**
@@ -216,46 +226,44 @@ function parse($uri) {
* it to generate a new uri.
*
* @param array $parts
+ *
* @return string
*/
-function build(array $parts) {
-
+function build(array $parts): string
+{
$uri = '';
$authority = '';
if (!empty($parts['host'])) {
$authority = $parts['host'];
if (!empty($parts['user'])) {
- $authority = $parts['user'] . '@' . $authority;
+ $authority = $parts['user'].'@'.$authority;
}
if (!empty($parts['port'])) {
- $authority = $authority . ':' . $parts['port'];
+ $authority = $authority.':'.$parts['port'];
}
}
if (!empty($parts['scheme'])) {
// If there's a scheme, there's also a host.
- $uri = $parts['scheme'] . ':';
-
+ $uri = $parts['scheme'].':';
}
- if ($authority || (!empty($parts['scheme']) && $parts['scheme'] === 'file')) {
+ if ($authority || (!empty($parts['scheme']) && 'file' === $parts['scheme'])) {
// No scheme, but there is a host.
- $uri .= '//' . $authority;
-
+ $uri .= '//'.$authority;
}
if (!empty($parts['path'])) {
$uri .= $parts['path'];
}
if (!empty($parts['query'])) {
- $uri .= '?' . $parts['query'];
+ $uri .= '?'.$parts['query'];
}
if (!empty($parts['fragment'])) {
- $uri .= '#' . $parts['fragment'];
+ $uri .= '#'.$parts['fragment'];
}
return $uri;
-
}
/**
@@ -274,16 +282,17 @@ function build(array $parts) {
* the end of the string is stripped off.
*
* @param string $path
+ *
* @return array
*/
-function split($path) {
-
+function split(string $path): array
+{
$matches = [];
if (preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u', $path, $matches)) {
return [$matches[1], $matches[2]];
}
- return [null,null];
+ return [null, null];
}
/**
@@ -297,10 +306,13 @@ function split($path) {
* crude and probably slow, so the original parse_url is usually preferred.
*
* @param string $uri
+ *
* @return array
+ *
+ * @throws InvalidUriException
*/
-function _parse_fallback($uri) {
-
+function _parse_fallback(string $uri): array
+{
// Normally a URI must be ASCII, however. However, often it's not and
// parse_url might corrupt these strings.
//
@@ -308,45 +320,43 @@ function _parse_fallback($uri) {
// uriencode them first.
$uri = preg_replace_callback(
'/[^[:ascii:]]/u',
- function($matches) {
+ function ($matches) {
return rawurlencode($matches[0]);
},
$uri
);
$result = [
- 'scheme' => null,
- 'host' => null,
- 'port' => null,
- 'user' => null,
- 'path' => null,
+ 'scheme' => null,
+ 'host' => null,
+ 'port' => null,
+ 'user' => null,
+ 'path' => null,
'fragment' => null,
- 'query' => null,
+ 'query' => null,
];
if (preg_match('% ^([A-Za-z][A-Za-z0-9+-\.]+): %x', $uri, $matches)) {
-
$result['scheme'] = $matches[1];
// Take what's left.
$uri = substr($uri, strlen($result['scheme']) + 1);
-
}
// Taking off a fragment part
- if (strpos($uri, '#') !== false) {
+ if (false !== strpos($uri, '#')) {
list($uri, $result['fragment']) = explode('#', $uri, 2);
}
// Taking off the query part
- if (strpos($uri, '?') !== false) {
+ if (false !== strpos($uri, '?')) {
list($uri, $result['query']) = explode('?', $uri, 2);
}
- if (substr($uri, 0, 3) === '///') {
- // The triple slash uris are a bit unusual, but we have special handling
- // for them.
- $result['path'] = substr($uri, 2);
- $result['host'] = '';
- } elseif (substr($uri, 0, 2) === '//') {
+ if ('///' === substr($uri, 0, 3)) {
+ // The triple slash uris are a bit unusual, but we have special handling
+ // for them.
+ $result['path'] = substr($uri, 2);
+ $result['host'] = '';
+ } elseif ('//' === substr($uri, 0, 2)) {
// Uris that have an authority part.
$regex = '
%^
@@ -360,11 +370,21 @@ function _parse_fallback($uri) {
if (!preg_match($regex, $uri, $matches)) {
throw new InvalidUriException('Invalid, or could not parse URI');
}
- if ($matches['host']) $result['host'] = $matches['host'];
- if ($matches['port']) $result['port'] = (int)$matches['port'];
- if (isset($matches['path'])) $result['path'] = $matches['path'];
- if ($matches['user']) $result['user'] = $matches['user'];
- if ($matches['pass']) $result['pass'] = $matches['pass'];
+ if ($matches['host']) {
+ $result['host'] = $matches['host'];
+ }
+ if (isset($matches['port'])) {
+ $result['port'] = (int) $matches['port'];
+ }
+ if (isset($matches['path'])) {
+ $result['path'] = $matches['path'];
+ }
+ if ($matches['user']) {
+ $result['user'] = $matches['user'];
+ }
+ if ($matches['pass']) {
+ $result['pass'] = $matches['pass'];
+ }
} else {
$result['path'] = $uri;
}
diff --git a/vendor/sabre/uri/phpstan.neon b/vendor/sabre/uri/phpstan.neon
new file mode 100644
index 000000000..341d02818
--- /dev/null
+++ b/vendor/sabre/uri/phpstan.neon
@@ -0,0 +1,3 @@
+parameters:
+ level: 7
+ bootstrap: %currentWorkingDirectory%/vendor/autoload.php