Completed
Push — master ( 71fa65...a9822c )
by Derek Stephen
01:47
created

IndexController::pingAction()   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
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Controller;
4
5
use DateTime;
6
use Swagger;
7
use Zend\Diactoros\Response;
8
use Zend\Diactoros\Stream;
9
10
/**
11
 * @SWG\Swagger(
12
 *     schemes={"https"},
13
 *     host="awesome.scot",
14
 *     basePath="/",
15
 *     @SWG\Info(
16
 *         version="1.0.0",
17
 *         title="BONE MVC API",
18
 *         description="This be a swashbucklin' API."
19
 *     ),
20
 *     @SWG\ExternalDocumentation(
21
 *         description="By delboy1978uk",
22
 *         url="https://github.com/delboy1978uk"
23
 *     )
24
 * )
25
 *
26
 */
27
class IndexController extends BaseController
28
{
29 1
    public function indexAction()
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
    /**
49
     * @return Response
50
     */
51
    public function apiAction()
52
    {
53
        $swagger = Swagger\scan(APPLICATION_PATH.'/src')->__toString();
54
        $response = new Response();
55
        $response = $response->withHeader('Content-Type', 'application/json');
56
        $response->getBody()->write($swagger);
57
        return $response;
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