|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Rs\VersionEye\Output; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Github. |
|
9
|
|
|
* |
|
10
|
|
|
* @author Robert Schönthal <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
class Github extends BaseOutput |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* output for sync api. |
|
16
|
|
|
* |
|
17
|
|
|
* @param OutputInterface $output |
|
18
|
|
|
* @param array $response |
|
19
|
|
|
*/ |
|
20
|
1 |
|
public function sync(OutputInterface $output, array $response) |
|
21
|
|
|
{ |
|
22
|
1 |
|
$this->printBoolean($output, 'OK', $response['status'], 'done' === $response['status']); |
|
23
|
1 |
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* output for hook api. |
|
27
|
|
|
* |
|
28
|
|
|
* @param OutputInterface $output |
|
29
|
|
|
* @param array $response |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function hook(OutputInterface $output, array $response) |
|
32
|
|
|
{ |
|
33
|
1 |
|
$this->printBoolean($output, 'OK', $response['success'], true === $response['success']); |
|
34
|
1 |
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* output for delete api. |
|
38
|
|
|
* |
|
39
|
|
|
* @param OutputInterface $output |
|
40
|
|
|
* @param array $response |
|
41
|
|
|
*/ |
|
42
|
1 |
|
public function delete(OutputInterface $output, array $response) |
|
43
|
|
|
{ |
|
44
|
1 |
|
$this->printBoolean($output, 'OK', $response['success'], true === $response['success']); |
|
45
|
1 |
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* output for repos api. |
|
49
|
|
|
* |
|
50
|
|
|
* @param OutputInterface $output |
|
51
|
|
|
* @param array $response |
|
52
|
|
|
*/ |
|
53
|
1 |
|
public function repos(OutputInterface $output, array $response) |
|
54
|
|
|
{ |
|
55
|
1 |
|
$this->printTable($output, |
|
56
|
1 |
|
['Name', 'Language', 'Description', 'Owner', 'Fork'], |
|
57
|
1 |
|
['fullname', 'language', 'description', 'owner_login', 'fork'], |
|
58
|
1 |
|
$response['repos'] |
|
59
|
|
|
); |
|
60
|
1 |
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* output for show api. |
|
64
|
|
|
* |
|
65
|
|
|
* @param OutputInterface $output |
|
66
|
|
|
* @param array $response |
|
67
|
|
|
*/ |
|
68
|
1 |
|
public function import(OutputInterface $output, array $response) |
|
69
|
|
|
{ |
|
70
|
1 |
|
$this->output($output, $response); |
|
71
|
1 |
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* output for import api. |
|
75
|
|
|
* |
|
76
|
|
|
* @param OutputInterface $output |
|
77
|
|
|
* @param array $response |
|
78
|
|
|
*/ |
|
79
|
1 |
|
public function show(OutputInterface $output, array $response) |
|
80
|
|
|
{ |
|
81
|
1 |
|
$this->output($output, $response); |
|
82
|
1 |
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* output for the import/show api. |
|
86
|
|
|
* |
|
87
|
|
|
* @param OutputInterface $output |
|
88
|
|
|
* @param array $response |
|
89
|
|
|
*/ |
|
90
|
2 |
|
private function output(OutputInterface $output, array $response) |
|
91
|
|
|
{ |
|
92
|
2 |
|
$this->printList($output, |
|
93
|
2 |
|
['Name', 'Homepage', 'Language', 'Description', 'Public', 'Created At', 'Http', 'Git'], |
|
94
|
2 |
|
['fullname', 'homepage', 'language', 'description', 'private', 'created_at', 'html_url', 'git_url'], |
|
95
|
2 |
|
$response['repo'] |
|
96
|
|
|
); |
|
97
|
2 |
|
} |
|
98
|
|
|
} |
|
99
|
|
|
|