Test Failed
Push — master ( 7f03ad...241680 )
by Maximo
02:01
created

library/Traits/ResponseTrait.php (1 issue)

1
<?php
0 ignored issues
show
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
    protected function halt(Micro $api, int $status, string $message)
27
    {
28
        $apiResponse = new Response();
29
30
        $apiResponse
31
            ->setPayloadError($message)
32
            ->setStatusCode($status)
33
            ->send();
34
35
        $api->stop();
36
    }
37
}
38