current_app_key()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
use ElfSundae\Laravel\Api\Helper;
4
use ElfSundae\Laravel\Api\ApiResponse;
5
6
if (! function_exists('api')) {
7
    /**
8
     * Create a new API response.
9
     *
10
     * @param  mixed  $data
11
     * @param  int|null  $code
12
     * @param  array  $headers
13
     * @param  int  $options
14
     * @return \ElfSundae\Laravel\Api\ApiResponse
15
     */
16
    function api($data = null, $code = null, $headers = [], $options = 0)
17
    {
18
        return new ApiResponse($data, $code, $headers, $options);
19
    }
20
}
21
22
if (! function_exists('current_app_key')) {
23
    /**
24
     * Get the app key of current api client.
25
     *
26
     * @see \ElfSundae\Laravel\Api\Middleware\VerifyApiToken
27
     *
28
     * @return string|null
29
     */
30
    function current_app_key()
31
    {
32
        return Helper::getCurrentAppKey();
33
    }
34
}
35