1 | <?php |
||
12 | class Products extends BaseOutput |
||
13 | { |
||
14 | /** |
||
15 | * output for the search API. |
||
16 | * |
||
17 | * @param OutputInterface $output |
||
18 | * @param array $response |
||
19 | */ |
||
20 | 1 | public function search(OutputInterface $output, array $response) |
|
24 | |||
25 | /** |
||
26 | * output for the references API. |
||
27 | * |
||
28 | * @param OutputInterface $output |
||
29 | * @param array $response |
||
30 | */ |
||
31 | 1 | public function references(OutputInterface $output, array $response) |
|
35 | |||
36 | /** |
||
37 | * output for the show API. |
||
38 | * |
||
39 | * @param OutputInterface $output |
||
40 | * @param array $response |
||
41 | */ |
||
42 | 1 | public function show(OutputInterface $output, array $response) |
|
43 | { |
||
44 | 1 | $this->printList($output, |
|
45 | 1 | ['Name', 'Description', 'Source', 'Archive', 'Key', 'Type', 'License', 'Version', 'Group', 'Updated At'], |
|
46 | 1 | ['name', 'description', 'links', 'archives', 'prod_key', 'prod_type', 'license_info', 'version', 'group_id', 'updated_at'], |
|
47 | $response, |
||
48 | function ($heading, $value) { |
||
49 | 1 | if ('Source' === $heading) { |
|
50 | 1 | if (!empty($value)) { |
|
51 | 1 | return array_pop($value)['link']; |
|
52 | } |
||
53 | } |
||
54 | |||
55 | 1 | if ('Archive' === $heading) { |
|
56 | 1 | return array_pop($value)['link']; |
|
57 | } |
||
58 | |||
59 | 1 | return $value; |
|
60 | 1 | } |
|
61 | ); |
||
62 | |||
63 | 1 | $this->printTable($output, |
|
64 | 1 | ['Name', 'Current', 'Requested'], |
|
65 | 1 | ['name', 'parsed_version', 'version'], |
|
66 | 1 | $response['dependencies'] |
|
67 | ); |
||
68 | 1 | } |
|
69 | |||
70 | /** |
||
71 | * output for the follow status API. |
||
72 | * |
||
73 | * @param OutputInterface $output |
||
74 | * @param array $response |
||
75 | */ |
||
76 | 1 | public function followStatus(OutputInterface $output, array $response) |
|
80 | |||
81 | /** |
||
82 | * output for the follow API. |
||
83 | * |
||
84 | * @param OutputInterface $output |
||
85 | * @param array $response |
||
86 | */ |
||
87 | 1 | public function follow(OutputInterface $output, array $response) |
|
91 | |||
92 | /** |
||
93 | * output for the unfollow API. |
||
94 | * |
||
95 | * @param OutputInterface $output |
||
96 | * @param array $response |
||
97 | */ |
||
98 | 1 | public function unfollow(OutputInterface $output, array $response) |
|
102 | |||
103 | /** |
||
104 | * output for the versions API. |
||
105 | * |
||
106 | * @param OutputInterface $output |
||
107 | * @param array $response |
||
108 | */ |
||
109 | 1 | public function versions(OutputInterface $output, array $response) |
|
130 | } |
||
131 |