Completed
Push — master ( 54dd0f...5e6629 )
by Park Jong-Hun
03:04
created

Auth   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A viewLoginForm() 0 4 1
A doLogin() 0 5 1
A doLogout() 0 5 1
1
<?php
2
3
namespace App\Controller;
4
5
use Core\Application;
6
use App\Auth\AuthManager;
7
use App\Auth\LoginManagerInterface;
8
use App\Auth\AccountManagerInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
11
class Auth
12
{
13
    public function viewLoginForm()
14
    {
15
        return 'auth/login';
16
    }
17
18
    public function doLogin(ServerRequestInterface $request)
19
    {
20
        AuthManager::getLoginManager()->login($request->getParsedBody()['account_id'], $request->getParsedBody()['password']);
21
        return 'redirect: ' . Application::getInstance()->url();
22
    }
23
24
    public function doLogout()
25
    {
26
        AuthManager::getLoginManager()->logout();
27
        return 'redirect: ' . Application::getInstance()->url();
28
    }
29
}
30