Skip to content

Commit

Permalink
1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Azzolini committed Mar 14, 2016
1 parent 5395de2 commit 1497e8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
14 changes: 7 additions & 7 deletions classes/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public function __construct($url=''){

public function __toString(){
$d = [];
if ($this->scheme) $d[] = "{$this->scheme}://";
if ($this->user) $d[] = "{$this->user}" . (empty($this->pass)?'':":{$this->pass}") . "@";
if ($this->host) $d[] = "{$this->host}";
if ($this->port) $d[] = ":{$this->port}";
if ($this->path) $d[] = "/" . ltrim($this->path,"/");
if ($this->query) $d[] = "?" . http_build_query($this->query);
if ($this->fragment) $d[] = "#{$this->fragment}";
if ($this->scheme) $d[] = "{$this->scheme}://";
if ($this->user) $d[] = "{$this->user}" . (empty($this->pass)?'':":{$this->pass}") . "@";
if ($this->host) $d[] = "{$this->host}";
if ($this->port) $d[] = ":{$this->port}";
if ($this->path) $d[] = "/" . ltrim($this->path,"/");
if (!empty($this->query)) $d[] = "?" . http_build_query($this->query);
if ($this->fragment) $d[] = "#{$this->fragment}";
return implode('', $d);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Components for rapid application development.",
"keywords": ["framework","core","sdk","toolbox"],
"homepage": "http://caffeina.com",
"version": "1.5.3",
"version": "1.6.0",
"license": "MIT",
"authors": [
{
Expand Down
12 changes: 1 addition & 11 deletions tests/URLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ public function testModify(){
}

public function testParseQuery(){
$url = new URL('https://user:[email protected]:9080/path/to/resource.html?foo=bar&another[]=2&another[]=3#frag_link');

$url = new URL("ftps://test.com:9000/index.php");

$url->scheme = 'https';
$url->port = false;

echo $url;


die;
$url = new URL('https://user:[email protected]:9080/path/to/resource.html?query=string&another[]=2&another[]=3#fragment');
$this->assertEquals('string', $url->query['query']);
}

Expand Down

0 comments on commit 1497e8e

Please sign in to comment.