-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-activity.php
85 lines (64 loc) · 1.92 KB
/
github-activity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
require_once 'functions.php';
if (isset($argv[1])) {
$events = getGithubEvents($argv[1]);
if (is_array($events)) {
usort($events, 'sortCreateEvent');
$output = ["Output:"];
foreach ($events as $event) {
switch ($event['type']) {
case 'CommitCommentEvent':
array_push($output, commitCommentEvent($event));
break;
case 'CreateEvent':
array_push($output, createEvent($event));
break;
case 'DeleteEvent':
array_push($output, deleteEvent($event));
break;
case 'ForkEvent':
array_push($output, forkEvent($event));
break;
case 'GollumEvent':
array_push($output, gollumEvent($event));
break;
case 'IssueCommentEvent':
array_push($output, issueCommentEvent($event));
break;
case 'IssueEvent':
array_push($output, issueEvent($event));
break;
case 'MemberEvent':
array_push($output, memberEvent($event));
break;
case 'PublicEvent':
array_push($output, publicEvent($event));
break;
case 'PullRequestEvent':
array_push($output, pullRequestEvent($event));
break;
case strpos($event['type'], 'PullRequestReview') !== false:
array_push($output, pullRequestReviewEvent($event));
break;
case 'PushEvent':
array_push($output, pushEvent($event));
break;
case 'ReleaseEvent':
array_push($output, releaseEvent($event));
break;
case 'SponsorshipEvent':
array_push($output, sponsorshipEvent($event));
break;
case 'WatchEvent':
array_push($output, watchEvent($event));
break;
}
}
$output[count($output) - 1] .= "\n";
echo implode("\n- ", $output);
exit;
}
echo $events;
} else {
echo help();
}