Completed
Push — master ( 0e0198...67c93c )
by Derek Stephen
02:26
created

IndexController::fakeClientCallbackAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Controller;
4
5
use Bone\Mvc\Controller;
6
use DateTime;
7
use Swagger;
8
9
/**
10
 * @SWG\Swagger(
11
 *     schemes={"https"},
12
 *     host="awesome.dev",
13
 *     basePath="/",
14
 *     @SWG\Info(
15
 *         version="1.0.0",
16
 *         title="BONE MVC API",
17
 *         description="This be a swashbucklin' API."
18
 *     ),
19
 *     @SWG\ExternalDocumentation(
20
 *         description="By delboy1978uk",
21
 *         url="https://github.com/delboy1978uk"
22
 *     )
23
 * )
24
 *
25
 */
26
class IndexController extends Controller
27
{
28 1
    public function indexAction()
29
    {
30
31 1
    }
32
33
    /**
34
     * Check basic connectivity. Returns a timestamp.
35
     * @SWG\Get(
36
     *     path="/ping",
37
     *     tags={"status"},
38
     *     @SWG\Response(response="200", description="Sends a response with the time")
39
     * )
40
     *
41
     */
42
    public function pingAction()
43
    {
44
        $date = new DateTime();
45
        $this->sendJsonResponse(['pong' => $date->format('Y-m-d H:i:s')]);
46
    }
47
48
    public function apiAction()
49
    {
50
        $swagger = Swagger\scan(APPLICATION_PATH.'/src');
51
        $this->disableLayout();
52
        $this->disableView();
53
        header('Content-Type: application/json');
54
        echo $swagger;
55
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method apiAction() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
56
    }
57
58
59
60
    public function fakeClientCallbackAction()
61
    {
62
        $request = $this->getRequest();
63
        die(var_dump($request));
0 ignored issues
show
Security Debugging Code introduced by
var_dump($request); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
Coding Style Compatibility introduced by
The method fakeClientCallbackAction() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
64
    }
65
}
66