Conditions | 2 |
Paths | 2 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
52 | public function handle(): bool |
||
53 | { |
||
54 | $input = fopen('php://input', 'r'); |
||
55 | |||
56 | $this->logger->info('send feedback report to [remote]', [ |
||
57 | 'category' => get_class($this), |
||
58 | 'remote' => $this->client->getConfig()['base_uri'] ?? '', |
||
59 | ]); |
||
60 | |||
61 | $res = $this->client->post('', [ |
||
62 | 'body' => $input, |
||
63 | 'http_errors' => false, |
||
64 | ]); |
||
65 | |||
66 | if ($res->getStatusCode() !== 201) { |
||
67 | $this->logger->error('sending feedback report failed with code [code] and message [error]', [ |
||
68 | 'category' => get_class($this), |
||
69 | 'code' => $res->getStatusCode(), |
||
70 | 'error' => $res->getBody()->read(10240), //only read 2KB which should be enaugh as error description |
||
71 | ]); |
||
72 | |||
73 | throw new Exception\InvalidFeedback('processing feedback failed with http code '.$res->getStatusCode()); |
||
74 | } |
||
75 | |||
76 | return true; |
||
77 | } |
||
78 | } |
||
79 |