Completed
Push — master ( a9b192...2e15dc )
by Elf
02:14
created

helpers.php ➔ current_app_key()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
use ElfSundae\Laravel\Api\Http\ApiResponse;
4
5
if (! function_exists('api')) {
6
    /**
7
     * Create a new API response.
8
     *
9
     * @return \ElfSundae\Laravel\Api\Http\ApiResponse
10
     */
11
    function api(...$args)
12
    {
13
        return new ApiResponse(...$args);
14
    }
15
}
16
17
if (! function_exists('current_app_key')) {
18
    /**
19
     * Get the app key of the current api client.
20
     *
21
     * @see \ElfSundae\Laravel\Api\Http\Middleware\VerifyApiToken
22
     *
23
     * @return string|null
24
     */
25
    function current_app_key()
26
    {
27
        return app('request')->attributes->get('current_app_key');
28
    }
29
}
30