Skip to content

Commit

Permalink
#15 replaced build*() functions with raw() in Builder\Bags
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkyPic committed Dec 10, 2018
1 parent de04947 commit c0b7e41
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Builder/Bags/PathBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function insertBefore(string $index, string $component): self
*
* @return string
*/
public function buildPath(bool $withTrailingSlash = true): string
public function raw(bool $withTrailingSlash = true): string
{
if (empty($this->pathComponents)) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/Bags/QueryBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function setQueryComponents(array $queryComponents): self
/**
* @return string
*/
public function buildQuery(): string
public function raw(): string
{
if (empty($this->queryComponents)) {
return '';
Expand Down
4 changes: 2 additions & 2 deletions src/Builder/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public function getUrl(bool $withTrailingSlash = true): string

$url .= $this->schema.'://';
$url .= $this->buildAuthority();
$url .= $this->path->buildPath($withTrailingSlash);
$url .= $this->query->buildQuery();
$url .= $this->path->raw($withTrailingSlash);
$url .= $this->query->raw();
if (null !== $this->fragment) {
$url .= '#'.$this->fragment;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Builder/Bags/PathBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public function test_should_build_correct_path()
$url = 'https://john.doe@www.example.com:123/forum/questions/phpunit/exceptions/?tag=networking&order=newest#top';
$parser = Parser::from($url);
$builder = Builder::from($parser);
$builder->path->buildPath();
$builder->path->raw();

$this->assertEquals('/forum/questions/phpunit/exceptions/', ($builder->path->buildPath()));
$this->assertEquals('/forum/questions/phpunit/exceptions/', ($builder->path->raw()));
}

public function test_remove_should_throw_exception_when_missing_component()
Expand Down
2 changes: 1 addition & 1 deletion tests/Builder/Bags/QueryBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function test_should_build_correct_query()
$parser = Parser::from($url);
$builder = Builder::from($parser);

$this->assertEquals('?tag=networking&order=newest', ($builder->query->buildQuery()));
$this->assertEquals('?tag=networking&order=newest', ($builder->query->raw()));
}

public function test_remove_should_throw_exception_when_missing_component()
Expand Down

0 comments on commit c0b7e41

Please sign in to comment.