0c33a016c4cbc643bfeeaf7a049c47df5ee0627d
3 namespace app\Controller\Github
;
5 use app\Controller\Github
;
7 class Repo
extends Github
9 function __invoke(array $args = null) {
11 if ($this->checkToken()) {
13 $this->github
->fetchRepo(
15 [$this, "repoCallback"]
17 } catch (\app\Github\Exception
$exception) {
18 $this->app
->getView()->addData(compact("exception", "owner", "name"));
20 $this->app
->display("github/repo");
24 function repoCallback($repo, $links) {
25 $this->app
->getView()->addData(compact("repo"));
26 settype($repo->tags
, "object");
27 $this->github
->fetchTags($repo->full_name
, 1, $this->createTagsCallback($repo));
28 $this->github
->fetchReleases($repo->full_name
, 1, $this->createReleasesCallback($repo));
31 function createReleasesCallback($repo) {
32 return function($releases, $links) use($repo) {
33 foreach ($releases as $release) {
34 $tag = $release->tag_name
;
35 settype($repo->tags
->$tag, "object");
36 $repo->tags
->$tag->release
= $release;
41 function createTagsCallback($repo) {
42 return function($tags, $links) use ($repo) {
43 foreach ($tags as $tag) {
45 settype($repo->tags
->$name, "object");
46 $repo->tags
->$name->tag
= $tag;