@@ -27,39 +27,31 @@ protected function execute(InputInterface $input, OutputInterface $output)
27
27
{
28
28
// outputs multiple lines to the console (adding "\n" at the end of each line)
29
29
$ http = HttpClient::getInstance ();
30
+ $ output ->writeln ([
31
+ "<comment>Executing Command -> app:request-url {$ input ->getArgument ('requesturl ' )}</comment> " ,
32
+ '************************************************** ' ,
33
+ ]);
30
34
31
- $ data = [];
32
- $ param = $ input ->getArgument ('params ' );
33
- $ result = explode (': ' , $ param );
34
- foreach ($ result as $ key ) {
35
+ $ execute = $ http ->makeRequest ($ input ->getArgument ('requesturl ' ),$ input ->getArgument ('method ' ),$ input ->getArgument ('params ' ));
35
36
37
+ if ($ execute ->status ) {
38
+ $ output ->writeln ([
39
+ "<bg=green;options=bold> {$ execute ->message }</> " ,
40
+ '************************************************** ' ,
41
+ ]);
42
+ $ result = ['statusCode ' => $ execute ->data ->code , 'body ' => $ execute ->data ->body ];
43
+ print_r ($ result );
44
+ $ output ->writeln ([
45
+ "<bg=blue;options=bold>Raw Body: {$ execute ->data }</> " ,
46
+ '************************************************** ' ,
47
+ ]);
48
+ }
49
+ else {
50
+ $ output ->writeln ([
51
+ "<bg=red;options=bold> {$ execute ->message }</> " ,
52
+ '************************************************** ' ,
53
+ ]);
36
54
}
37
- print_r ($ data );
38
- // $output->writeln([
39
- // "<comment>Executing Command -> app:request-url {$input->getArgument('requesturl')}</comment>",
40
- // '**************************************************',
41
- // ]);
42
- //
43
- // $execute = $http->makeRequest($input->getArgument('requesturl'),$input->getArgument('method'),$input->getArgument('params'));
44
- //
45
- // if ($execute->status) {
46
- // $output->writeln([
47
- // "<bg=green;options=bold>{$execute->message}</>",
48
- // '**************************************************',
49
- // ]);
50
- // $result = ['statusCode' => $execute->data->code, 'body' => $execute->data->body];
51
- // print_r($result);
52
- // $output->writeln([
53
- // "<bg=blue;options=bold>Raw Body: {$execute->data}</>",
54
- // '**************************************************',
55
- // ]);
56
- // }
57
- // else {
58
- // $output->writeln([
59
- // "<bg=red;options=bold>{$execute->message}</>",
60
- // '**************************************************',
61
- // ]);
62
- // }
63
55
// $output->writeln([]), $input->getArgument('method')]);
64
56
65
57
0 commit comments