public static function authenticateUser($email, $token) { $headers[] = sprintf('Authorization: token %s', $token); $url = 'https://api.github.com/user'; $response = CurlComunication::simpleGet($url, $headers); if ($response->email != $email) { return false; } return true; }
public static function searchRepositores($query) { $url = 'https://api.github.com/search/repositories?q=' . $query; $response = CurlComunication::simpleGet($url); $list = []; foreach ($response->items as $item) { $list[] = array("id" => $item->id, "name" => $item->full_name, "description" => $item->description, "owner" => $item->owner->login, "url" => $item->html_url, "fork_url" => $item->forks_url); } return $list; }