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    public function readResponse(
24        \Psr\Http\Message\RequestInterface $request,
25        \Psr\Http\Message\ResponseInterface $response,
26        array $args
27    ) {
28        $entityId = Validator::value($args['id'])->isNumber()->getValue();
29        $result = \App::$http->readDeleteResult('/availability/' . $entityId . '/');
30        $apiResponse = $result->getResponse();
31        $body = (string) $apiResponse->getBody();
32        $stream = (new StreamFactory())->createStream($body);
33        return $apiResponse
34            ->withBody($stream)
35            ->withoutHeader('Transfer-Encoding')
36            ->withoutHeader('Content-Length')
37            ->withHeader('Content-Length', (string) strlen($body));
38    }
39}