Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AvailabilityDelete
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @package Zmsadmin
5 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
6 **/
7
8namespace BO\Zmsadmin;
9
10use BO\Mellon\Validator;
11use Slim\Psr7\Factory\StreamFactory;
12
13/**
14 * Delete availability, API proxy
15 *
16 */
17class AvailabilityDelete extends BaseController
18{
19    /**
20     * @SuppressWarnings(UnusedFormalParameter)
21     * @return \Psr\Http\Message\ResponseInterface
22     */
23    #[\Override]
24    public function readResponse(
25        \Psr\Http\Message\RequestInterface $request,
26        \Psr\Http\Message\ResponseInterface $response,
27        array $args
28    ) {
29        $entityId = Validator::value($args['id'])->isNumber()->getValue();
30        $result = \App::$http->readDeleteResult('/availability/' . $entityId . '/');
31        $apiResponse = $result->getResponse();
32        $body = (string) $apiResponse->getBody();
33        $stream = (new StreamFactory())->createStream($body);
34        return $apiResponse
35            ->withBody($stream)
36            ->withoutHeader('Transfer-Encoding')
37            ->withoutHeader('Content-Length')
38            ->withHeader('Content-Length', (string) strlen($body));
39    }
40}