4
4
5
5
use Illuminate \Contracts \Auth \Authenticatable as AuthenticatableContract ;
6
6
use Illuminate \Contracts \Mail \Mailer as MailerContract ;
7
- use Illuminate \Mail \Message ;
8
7
use Illuminate \Database \Schema \Builder ;
9
8
use Illuminate \Support \Str ;
10
9
use Jrean \UserVerification \Exceptions \VerificationException ;
@@ -21,16 +20,15 @@ class UserVerification
21
20
/**
22
21
* Schema builder instance.
23
22
*
24
- * @var \Illuminate\Database\Schema\Builder $schema
23
+ * @var \Illuminate\Database\Schema\Builder
25
24
*/
26
25
protected $ schema ;
27
26
28
27
/**
29
28
* Constructor.
30
29
*
31
- * @param \Illuminate\Contracts\Mail\Mailer $mailer
30
+ * @param \Illuminate\Contracts\Mail\Mailer $mailer
32
31
* @param \Illuminate\Database\Schema\Builder $schema
33
- *
34
32
* @return void
35
33
*/
36
34
public function __construct (MailerContract $ mailer , Builder $ schema )
@@ -43,8 +41,8 @@ public function __construct(MailerContract $mailer, Builder $schema)
43
41
/**
44
42
* Generate and save a verification token the given user.
45
43
*
46
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
47
- * @return boolean
44
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
45
+ * @return bool
48
46
*/
49
47
public function generate (AuthenticatableContract $ model )
50
48
{
@@ -54,14 +52,14 @@ public function generate(AuthenticatableContract $model)
54
52
/**
55
53
* Send by email a link containing the verification token.
56
54
*
57
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
58
- * @param string $subject
59
- * @return boolean
55
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
56
+ * @param string $subject
57
+ * @return bool
60
58
*/
61
59
public function send (AuthenticatableContract $ model , $ subject = null )
62
60
{
63
- if ( ! $ this ->isCompliant ($ model )) {
64
- throw new VerificationException ;
61
+ if (! $ this ->isCompliant ($ model )) {
62
+ throw new VerificationException () ;
65
63
}
66
64
67
65
return (boolean ) $ this ->emailVerificationLink ($ model , $ subject );
@@ -70,13 +68,13 @@ public function send(AuthenticatableContract $model, $subject = null)
70
68
/**
71
69
* Process the token verification.
72
70
*
73
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
74
- * @param string $token
75
- * @return boolean
71
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
72
+ * @param string $token
73
+ * @return bool
76
74
*/
77
75
public function process (AuthenticatableContract $ model , $ token )
78
76
{
79
- if ( ! $ this ->compareToken ($ model ->verification_token , $ token )) {
77
+ if (! $ this ->compareToken ($ model ->verification_token , $ token )) {
80
78
return false ;
81
79
}
82
80
@@ -88,8 +86,8 @@ public function process(AuthenticatableContract $model, $token)
88
86
/**
89
87
* Check if the user is verified.
90
88
*
91
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
92
- * @return boolean
89
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
90
+ * @return bool
93
91
*/
94
92
public function isVerified (AuthenticatableContract $ model )
95
93
{
@@ -99,7 +97,7 @@ public function isVerified(AuthenticatableContract $model)
99
97
/**
100
98
* Update and save the model instance has verified.
101
99
*
102
- * @param AuthenticatableContract $model
100
+ * @param AuthenticatableContract $model
103
101
* @return void
104
102
*/
105
103
protected function wasVerified (AuthenticatableContract $ model )
@@ -114,9 +112,9 @@ protected function wasVerified(AuthenticatableContract $model)
114
112
/**
115
113
* Compare the verification token given by the user with the one stored.
116
114
*
117
- * @param string $storedToken
118
- * @param string $requestToken
119
- * @return boolean
115
+ * @param string $storedToken
116
+ * @param string $requestToken
117
+ * @return bool
120
118
*/
121
119
protected function compareToken ($ storedToken , $ requestToken )
122
120
{
@@ -126,8 +124,8 @@ protected function compareToken($storedToken, $requestToken)
126
124
/**
127
125
* Prepare and send the email with the verification token link.
128
126
*
129
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
130
- * @param string $subject
127
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
128
+ * @param string $subject
131
129
* @return mixed
132
130
*/
133
131
protected function emailVerificationLink (AuthenticatableContract $ model , $ subject )
@@ -152,15 +150,16 @@ protected function generateToken()
152
150
/**
153
151
* Update and save the model instance with the verification token.
154
152
*
155
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
156
- * @param string $token
157
- * @return boolean
153
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
154
+ * @param string $token
155
+ * @return bool
156
+ *
158
157
* @throws \Jrean\UserVerification\Exceptions\VerificationException
159
158
*/
160
159
protected function saveToken (AuthenticatableContract $ model , $ token )
161
160
{
162
- if ( ! $ this ->isCompliant ($ model )) {
163
- throw new VerificationException ;
161
+ if (! $ this ->isCompliant ($ model )) {
162
+ throw new VerificationException () ;
164
163
}
165
164
166
165
$ model ->verification_token = $ token ;
@@ -172,12 +171,11 @@ protected function saveToken(AuthenticatableContract $model, $token)
172
171
* Determine if the given model table has the verified and verification_token
173
172
* columns.
174
173
*
175
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
176
- * @return boolean
174
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
175
+ * @return bool
177
176
*/
178
177
protected function isCompliant (AuthenticatableContract $ model )
179
178
{
180
- return false ;
181
179
if (
182
180
$ this ->hasColumn ($ model , 'verified ' )
183
181
&& $ this ->hasColumn ($ model , 'verification_token ' )
@@ -191,9 +189,9 @@ protected function isCompliant(AuthenticatableContract $model)
191
189
/**
192
190
* Check if the given model talbe has the given column.
193
191
*
194
- * @param \Illuminate\Contracts\Auth\Authenticatable $model
195
- * @param string $column
196
- * @return boolean
192
+ * @param \Illuminate\Contracts\Auth\Authenticatable $model
193
+ * @param string $column
194
+ * @return bool
197
195
*/
198
196
protected function hasColumn (AuthenticatableContract $ model , $ column )
199
197
{
0 commit comments