Branches.php 764 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Gogs\API\Request {
  3. final class Brances extends Collection {
  4. protected $repo;
  5. public function __construct(string $api_url, string $api_token, Repo $repo) {
  6. $this->repo = $repo;
  7. parent::__construct($api_url, $api_token);
  8. }
  9. protected function set_scope(string $method) {
  10. switch ($method) {
  11. case "get":
  12. case "load":
  13. if ($owner == null)
  14. throw new Exception\InvalidMethodRequestException("Missing repository for branches");
  15. $this->scope = sprintf("/repos/%s/%s/branches", $this->repo->owner, $this->repo->name);
  16. return true;
  17. }
  18. return false;
  19. }
  20. }
  21. }