Skip to content

Commit

Permalink
Merge pull request #7 from staabm/patch-1
Browse files Browse the repository at this point in the history
Use global namespace for native functions
  • Loading branch information
kelunik authored Jun 24, 2017
2 parents 59b0d5d + 137fb14 commit 63b89f8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ private function removeDotSegments(string $input): string {
$patternE = ',(/*[^/]*),';

while ($input !== '') {
if (preg_match($patternA, $input)) {
$input = preg_replace($patternA, '', $input);
} elseif (preg_match($patternB1, $input, $match) || preg_match($patternB2, $input, $match)) {
if (\preg_match($patternA, $input)) {
$input = \preg_replace($patternA, '', $input);
} elseif (\preg_match($patternB1, $input, $match) || \preg_match($patternB2, $input, $match)) {
$input = preg_replace(",^" . $match[1] . ",", '/', $input);
} elseif (preg_match($patternC, $input, $match)) {
$input = preg_replace(',^' . preg_quote($match[1], ',') . ',', '/', $input);
$output = preg_replace(',/([^/]+)$,', '', $output);
} elseif (\preg_match($patternC, $input, $match)) {
$input = \preg_replace(',^' . \preg_quote($match[1], ',') . ',', '/', $input);
$output = \preg_replace(',/([^/]+)$,', '', $output);
} elseif ($input == '.' || $input == '..') { // pattern D
$input = '';
} elseif (preg_match($patternE, $input, $match)) {
} elseif (\preg_match($patternE, $input, $match)) {
$initialSegment = $match[1];
$input = preg_replace(',^' . preg_quote($initialSegment, ',') . ',', '', $input, 1);
$input = \preg_replace(',^' . \preg_quote($initialSegment, ',') . ',', '', $input, 1);
$output .= $initialSegment;
}
}
Expand All @@ -203,13 +203,13 @@ private function removeDotSegments(string $input): string {
* @see http://www.apps.ietf.org/rfc/rfc3986.html#sec-2.3
*/
private function decodeUnreservedCharacters($str) {
$str = rawurldecode($str);
$str = rawurlencode($str);
$str = \rawurldecode($str);
$str = \rawurlencode($str);

$encoded = ['%2F', '%3A', '%40'];
$decoded = ['/', ':', '@'];

return str_replace($encoded, $decoded, $str);
return \str_replace($encoded, $decoded, $str);
}

/**
Expand Down Expand Up @@ -406,9 +406,9 @@ private function parseQueryParameters() {
if ($this->query) {
$parameters = [];

foreach (explode("&", $this->query) as $pair) {
foreach (\explode("&", $this->query) as $pair) {
$pair = explode("=", $pair, 2);
$parameters[rawurldecode($pair[0])][] = rawurldecode($pair[1] ?? "");
$parameters[\rawurldecode($pair[0])][] = \rawurldecode($pair[1] ?? "");
}

$this->queryParameters = $parameters;
Expand Down

0 comments on commit 63b89f8

Please sign in to comment.