Created
August 7, 2015 19:39
-
-
Save killerwolf/eb3e5132136b83a613ae to your computer and use it in GitHub Desktop.
S.O.L.I.D for Dummies
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
<?php | |
class APICall{ | |
const API_ENDPOINT = "http://api.example.org/v1/en/users.json"; | |
public $query = []; | |
public function buildQuery(array $query) | |
{ | |
return http_build_query($query); | |
} | |
public function setQuery() | |
{ | |
$this->query = $query; | |
} | |
public function getData(){ | |
return json_decode(file_get_contents(sprintf('%s?%s',API_ENDPOINT,$this->buildQuery($query)))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment