abstract.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. This file is part of Resumer
  4. Copyright (C) 2016 Sylvia van Os
  5. Resumer is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU Affero General Public License as
  7. published by the Free Software Foundation, either version 3 of the
  8. License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Affero General Public License for more details.
  13. You should have received a copy of the GNU Affero General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. declare(strict_types=1);
  17. abstract class RepoParser
  18. {
  19. protected function callApi(string $url, array $streamopts) : string {
  20. return file_get_contents($url, false, stream_context_create($streamopts));
  21. }
  22. abstract public function __construct(string $username);
  23. abstract public function getIdentifier() : string;
  24. abstract public function getProfileUrl(string $username) : string;
  25. abstract public function getRepos() : array;
  26. abstract public function getName(int $repo) : string;
  27. abstract public function getHomepage(int $repo) : string;
  28. abstract public function getRepositoryUrl(int $repo) : string;
  29. abstract public function getDescription(int $repo) : string;
  30. abstract public function getLanguage(int $repo) : string;
  31. abstract public function getStarCount(int $repo) : int;
  32. abstract public function getWatcherCount(int $repo) : int;
  33. abstract public function getForkCount(int $repo) : int;
  34. abstract public function getCreationDate(int $repo) : array;
  35. abstract public function getLastUpdatedDate(int $repo) : array;
  36. }