Completed
Branch dev (d5d70c)
by Raffael
11:00
created

Api::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * balloon
7
 *
8
 * @copyright   Copryright (c) 2012-2018 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Balloon\App\Api\v2;
13
14
use Balloon\App\Api\Controller;
15
use Micro\Http\Response;
16
17
class Api extends Controller
18
{
19
    /**
20
     * @api {get} / Server & API Status
21
     * @apiVersion 2.0.0
22
     * @apiName get
23
     * @apiGroup Api
24
     * @apiPermission none
25
     * @apiDescription Get server time and api status/version
26
     *
27
     * @apiExample Example usage:
28
     * curl -XGET "https://SERVER/api/v2?pretty"
29
     *
30
     * @apiSuccess {string} name balloon identifier
31
     * @apiSuccess {number} api_version API Version
32
     * @apiSuccessExample {json} Success-Response:
33
     * HTTP/1.1 200 OK
34
     * {
35
     *      "name": "balloon",
36
     *      "api_version": 2
37
     * }
38
     *
39
     * @return Response
40
     */
41
    public function get(): Response
42
    {
43
        $data = [
44
            'name' => 'balloon',
45
            'api_version' => 2,
46
        ];
47
48
        return (new Response())->setCode(200)->setBody($data);
49
    }
50
}
51