Test Failed
Pull Request — master (#9)
by Maximo
03:26
created

ResponseTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A halt() 0 10 1
1
<?php
0 ignored issues
show
Coding Style introduced by
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Traits;
6
7
use Gewaer\Http\Response;
8
use Phalcon\Mvc\Micro;
9
10
/**
11
 * Trait ResponseTrait
12
 *
13
 * @package Gewaer\Traits
14
 */
15
trait ResponseTrait
16
{
17
    /**
18
     * Halt execution after setting the message in the response
19
     *
20
     * @param Micro  $api
21
     * @param int    $status
22
     * @param string $message
23
     *
24
     * @return mixed
25
     */
26 1
    protected function halt(Micro $api, int $status, string $message)
27
    {
28 1
        $apiResponse = new Response();
29
30
        $apiResponse
31 1
            ->setPayloadError($message)
32 1
            ->setStatusCode($status)
33 1
            ->send();
34
35 1
        $api->stop();
36 1
    }
37
}
38