Skip to content

Instantly share code, notes, and snippets.

@saxenap
Last active September 7, 2015 17:01
Show Gist options
  • Save saxenap/879eca92233c49e7fe83 to your computer and use it in GitHub Desktop.
Save saxenap/879eca92233c49e7fe83 to your computer and use it in GitHub Desktop.
interface BuildsQuery
{
public function make();
public function __toString();
}
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