Skip to content

Commit

Permalink
fix get items from url patch on empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
vasiliishvakin committed Apr 14, 2019
1 parent a040bd4 commit 7c8cede
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Url/Path.php
Expand Up @@ -78,8 +78,12 @@ protected function &getItems()
$this->items = [];
} else {
$string = $this->getNormalStr();
$string = trim($string, "/");
$this->setItems(explode("/", $string));
$string = trim(trim($string, "/"));
if ($string !== "") {
$this->setItems(explode("/", $string));
} else {
$this->items = [];
}
}
}
return $this->items;
Expand All @@ -99,7 +103,7 @@ public function __toString()
return rawurlencode($val);
}, $this->toArray());

$this->composedString = "/". implode("/", $parts);
$this->composedString = "/" . implode("/", $parts);
}
return $this->composedString;
}
Expand Down

0 comments on commit 7c8cede

Please sign in to comment.