Branch.php 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Gogs\API\Request {
  3. /**
  4. * A single Branch
  5. *
  6. * @author Joachim M. Giaever (joachim[]giaever.org)
  7. * @version 0.1
  8. */
  9. final class Branch extends Base {
  10. private $repo;
  11. public $branch_name;
  12. public $branch_commit;
  13. /**
  14. * Initialize a branch for the given repository.
  15. *
  16. * @see Base
  17. * @param Repo $repo
  18. */
  19. public function __construct(string $api_url, string $api_token, Repo $repo) {
  20. parent::__construct($api_url, $api_token);
  21. $this->repo = $repo;
  22. }
  23. /**
  24. * @see Base
  25. */
  26. protected function set_scope(string $method) {
  27. switch ($method) {
  28. case "load":
  29. $this->scope = sprintf("/repos/%s/%s/branches/%s", $this->repo->owner, $this->repo->name, $this->name);
  30. return true;
  31. }
  32. return false;
  33. }
  34. }
  35. }
  36. ?>