User::actionEndpoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
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