Completed
Push — master ( 272243...2e6f42 )
by Sherif
13:48
created

ErrorHandler::invalidConfirmationCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace App\Modules\Core\Utl;
2
3
class ErrorHandler
4
{
5
	public function unAuthorized()
6
	{
7
		$error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
		abort($error['status'], $error['message']);
9
	}
10
11
	public function invalidRefreshToken()
12
	{
13
		$error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
		abort($error['status'], $error['message']);
15
	}
16
17
	 public function noPermissions()
18
	{
19
		$error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
		abort($error['status'], $error['message']);
21
	}
22
23
	public function loginFailed()
24
	{
25
		$error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
		abort($error['status'], $error['message']);
27
	}
28
29
	public function noSocialEmail()
30
	{
31
		$error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
		abort($error['status'], $error['message']);
33
	}
34
35
	public function userAlreadyRegistered()
36
	{
37
		$error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
		abort($error['status'], $error['message']);
39
	}
40
41
	public function connectionError()
42
	{
43
		$error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
		abort($error['status'], $error['message']);
45
	}
46
47
	public function redisNotRunning()
48
	{
49
		$error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
		abort($error['status'], $error['message']);
51
	}
52
53
	public function dbQueryError()
54
	{
55
		$error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
		abort($error['status'], $error['message']);
57
	}
58
59
	public function cannotCreateSetting()
60
	{
61
		$error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
		abort($error['status'], $error['message']);
63
	}
64
65
	public function cannotUpdateSettingKey()
66
	{
67
		$error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
		abort($error['status'], $error['message']);
69
	}
70
71
	public function userIsBlocked()
72
	{
73
		$error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
		abort($error['status'], $error['message']);
75
	}
76
77
	public function emailNotConfirmed()
78
	{
79
		$error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
		abort($error['status'], $error['message']);
81
	}
82
83
	public function emailAlreadyConfirmed()
84
	{
85
		$error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
		abort($error['status'], $error['message']);
87
	}
88
89
	public function invalidResetToken()
90
	{
91
		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
		abort($error['status'], $error['message']);
93
	}
94
95
	public function invalidResetPassword()
96
	{
97
		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
		abort($error['status'], $error['message']);
99
	}
100
101
	public function invalidOldPassword()
102
	{
103
		$error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
		abort($error['status'], $error['message']);
105
	}
106
107
    public function invalidConfirmationCode()
108
    {
109
        $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
        abort($error['status'], $error['message']);
111
    }
112
113
	public function notFound($text)
114
	{
115
		$error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
116
		abort($error['status'], $error['message']);
117
	}
118
119
	public function generalError()
120
	{
121
		$error = ['status' => 400, 'message' => trans('core::errors.generalError')];
122
		abort($error['status'], $error['message']);
123
	}
124
}