BaseController::createResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
crap 1
1
<?php
2
3
namespace App\Controllers;
4
5
use App\Application;
6
7
abstract class BaseController
8
{
9 3
    protected function createResponse($body, Application $app, $httpCode = 200)
10
    {
11 3
        $response = $app->getResponse($httpCode);
12 3
        $response->getBody()->write($body);
13 3
        $response->withHeader('Content-Length', strlen($body));
14
15 3
        return $response;
16
    }
17
}
18