Last active
September 7, 2015 17:01
-
-
Save saxenap/879eca92233c49e7fe83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface BuildsQuery | |
{ | |
public function make(); | |
public function __toString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QueryString implements BuildsQuery | |
{ | |
private $url; | |
private $_queryData; | |
public function __construct($url, $_queryData) | |
{ | |
$this->url = $url; | |
$this->_queryData = $_queryData; | |
} | |
public function make() | |
{ | |
$query = http_build_query($this->_queryData, ''); | |
return "{$this->url}?{$query}"; | |
} | |
public function __toString() | |
{ | |
return $this->make(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment