index.php 744 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * TODO:
  4. *
  5. * Rewrite this. Shouldnt be a test file, like its now.
  6. *
  7. * */
  8. define('BASE_PATH', realpath(dirname(__FILE__)));
  9. function my_autoloader($class)
  10. {
  11. $file = str_replace("\\", DIRECTORY_SEPARATOR, strtolower($class)) . ".php";
  12. echo $class . ' -> ' . $file . "\n";
  13. require_once BASE_PATH . DIRECTORY_SEPARATOR . $file;
  14. }
  15. spl_autoload_register('my_autoloader');
  16. try {
  17. $client = new \Client\GogsAPI(API_URL, API_TOKEN);
  18. $me = $client->user();
  19. $other = $client->user("bje007");
  20. $repos = $me->get("/repos")->load();
  21. for($repo = $repos->current(); $repo != false; $repo = $repos->next())
  22. var_dump($repo);
  23. } catch (\Lib\NotAutorizedException $e) {
  24. die($e->getMessage());
  25. }
  26. ?>