Test Failed
Push — master ( ab76be...ac2d3a )
by Julien
04:26
created

StatusCode   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 3
c 1
b 1
f 0
dl 0
loc 9
ccs 0
cts 0
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A setStatusCode() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Mvc\Controller;
13
14
use Phalcon\Http\ResponseInterface;
15
16
/**
17
 * Mostly designed for Error Controllers
18
 */
19
trait StatusCode
20
{
21
    /**
22
     * Set the status code to the response
23
     */
24
    public function setStatusCode(int $code = 200, ?string $message = null): ResponseInterface
25
    {
26
        $message ??= \Zemit\Http\StatusCode::getMessage($code);
27
        return $this->response->setStatusCode($code, $message);
28
    }
29
}
30