respondWith()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
1
<?php
2
3
if (! function_exists('sendAndTerminate')) {
4
    /**
5
     * Get the path to the resources folder.
6
     *
7
     * @param  string  $response
8
     * @return null|\Illuminate\Contracts\Routing\ResponseFactory
9
     */
10
    function sendAndTerminate($response = null)
11
    {
12
        return respondWith($response);
13
    }
14
}
15
16
if (! function_exists('respondWith')) {
17
    /**
18
     * Get the path to the resources folder.
19
     *
20
     * @param  string  $response
21
     * @return null|\Illuminate\Contracts\Routing\ResponseFactory
22
     *
23
     * @throws \ImanGhafoori\Terminator\TerminateException
24
     */
25
    function respondWith($response = null)
26 3
    {
27 3
        if (is_null($response)) {
28
            return app(ImanGhafoori\Terminator\Responder::class);
29 3
        }
30
        app(ImanGhafoori\Terminator\Terminator::class)->respondWith($response);
31
    }
32
}
33