Failed Conditions
Pull Request — master (#10)
by Maximo
03:08
created

NotFoundMiddleware::call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Middleware;
6
7
use Gewaer\Http\Response;
8
use Gewaer\Traits\ResponseTrait;
9
use Phalcon\Mvc\Micro;
10
use Phalcon\Mvc\Micro\MiddlewareInterface;
11
use Phalcon\Mvc\User\Plugin;
12
13
/**
14
 * Class NotFoundMiddleware
15
 *
16
 * @package Gewaer\Middleware
17
 *
18
 * @property Micro    $application
19
 * @property Response $response
20
 */
21
class NotFoundMiddleware extends Plugin implements MiddlewareInterface
22
{
23
    use ResponseTrait;
24
25
    /**
26
     * Checks if the resource was found
27
     */
28 1
    public function beforeNotFound()
29
    {
30 1
        $apiResponse = new Response();
31 1
        $this->halt(
32 1
            $this->application,
33 1
            Response::NOT_FOUND,
34 1
            $apiResponse->getHttpCodeDescription($apiResponse::NOT_FOUND)
35
        );
36
37 1
        return false;
38
    }
39
40
    /**
41
     * Call me
42
     *
43
     * @param Micro $api
44
     *
45
     * @return bool
46
     */
47 2
    public function call(Micro $api)
48
    {
49 2
        return true;
50
    }
51
}
52