User::actionAuth()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Apps\Controller\Api;
4
5
use Extend\Core\Arch\ApiController;
6
use Ffcms\Core\App;
7
use Ffcms\Core\Exception\JsonException;
8
9
/**
10
 * Class User. User api features controller
11
 * @package Apps\Controller\Api
12
 */
13
class User extends ApiController
14
{
15
16
    /**
17
     * Check user auth.
18
     * @return string
19
     * @throws JsonException
20
     */
21
    public function actionAuth()
22
    {
23
        $this->setJsonHeader();
24
        if (!App::$User->isAuth()) {
25
            throw new JsonException('No auth');
26
        }
27
28
        return json_encode([
29
            'status' => 1,
30
            'data' => 'Auth done'
31
        ]);
32
    }
33
34
    /**
35
     * Hybridauth endpoint.
36
     */
37
    public function actionEndpoint()
38
    {
39
        \Hybrid_Endpoint::process();
40
    }
41
}
42