Test Setup Failed
Push — master ( f0f097...c6f3d6 )
by Php Easy Api
04:31
created

AuthenticateException   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A credentials() 0 3 1
A exceptionManager() 0 3 1
A getExceptionForHttp() 0 3 1
A logoutException() 0 3 1
A logoutInternal() 0 3 1
A update() 0 3 1
A tokenException() 0 3 1
1
<?php
2
3
namespace Resta\Authenticate;
4
5
trait AuthenticateException
6
{
7
    /**
8
     * @return void|mixed
9
     */
10
    public function getExceptionForHttp($http)
11
    {
12
        exception('authenticateHttpException')->badMethodCall('Authenticate requests ['.$http.'] as http method');
13
    }
14
15
    /**
16
     * @return void|mixed
17
     */
18
    public function credentials()
19
    {
20
        exception('authenticateCredentialException')->invalidArgument('credentials fail for authenticate');
21
    }
22
23
    /**
24
     * @param $exceptionType
25
     */
26
    public function exceptionManager($exceptionType)
27
    {
28
        return $this->{$exceptionType}();
29
    }
30
31
    /**
32
     * logout exception
33
     *
34
     * @return mixed|void
35
     */
36
    public function logoutException()
37
    {
38
        exception('authenticateLogoutException')->runtime('no such token data is available.');
39
    }
40
41
    /**
42
     * logout exception
43
     *
44
     * @return mixed|void
45
     */
46
    public function logoutInternal()
47
    {
48
        exception('authenticateLogoutInternal')->runtime('You have failed to sign out. There was a problem with us. Please try again.');
49
    }
50
51
    /**
52
     * token exception
53
     *
54
     * @return mixed|void
55
     */
56
    public function tokenException()
57
    {
58
        exception('authenticateTokenException')->invalidArgument('Your token is missing for authenticate process');
59
    }
60
61
    /**
62
     * update exception
63
     *
64
     * @return mixed|void
65
     */
66
    public function update()
67
    {
68
        exception('authenticateUpdateException')->invalidArgument('Updating Token for authenticate is missing.');
69
    }
70
}