Skip to content

Commit 3737be8

Browse files
committed
Syntax
2 parents 4b635b4 + fab1d89 commit 3737be8

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

src/Traits/VerifiesUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getVerification($token)
3838
return redirect($this->redirectIfVerified());
3939
}
4040

41-
if ( ! UserVerification::process($user, $token)) {
41+
if (!UserVerification::process($user, $token)) {
4242
return redirect($this->redirectIfVerificationFails());
4343
}
4444

src/UserVerification.php

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
66
use Illuminate\Contracts\Mail\Mailer as MailerContract;
7-
use Illuminate\Mail\Message;
87
use Illuminate\Database\Schema\Builder;
98
use Illuminate\Support\Str;
109
use Jrean\UserVerification\Exceptions\VerificationException;
@@ -21,16 +20,15 @@ class UserVerification
2120
/**
2221
* Schema builder instance.
2322
*
24-
* @var \Illuminate\Database\Schema\Builder $schema
23+
* @var \Illuminate\Database\Schema\Builder
2524
*/
2625
protected $schema;
2726

2827
/**
2928
* Constructor.
3029
*
31-
* @param \Illuminate\Contracts\Mail\Mailer $mailer
30+
* @param \Illuminate\Contracts\Mail\Mailer $mailer
3231
* @param \Illuminate\Database\Schema\Builder $schema
33-
*
3432
* @return void
3533
*/
3634
public function __construct(MailerContract $mailer, Builder $schema)
@@ -43,8 +41,8 @@ public function __construct(MailerContract $mailer, Builder $schema)
4341
/**
4442
* Generate and save a verification token the given user.
4543
*
46-
* @param \Illuminate\Contracts\Auth\Authenticatable $model
47-
* @return boolean
44+
* @param \Illuminate\Contracts\Auth\Authenticatable $model
45+
* @return bool
4846
*/
4947
public function generate(AuthenticatableContract $model)
5048
{
@@ -54,14 +52,14 @@ public function generate(AuthenticatableContract $model)
5452
/**
5553
* Send by email a link containing the verification token.
5654
*
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
6058
*/
6159
public function send(AuthenticatableContract $model, $subject = null)
6260
{
63-
if ( ! $this->isCompliant($model)) {
64-
throw new VerificationException;
61+
if (! $this->isCompliant($model)) {
62+
throw new VerificationException();
6563
}
6664

6765
return (boolean) $this->emailVerificationLink($model, $subject);
@@ -70,13 +68,13 @@ public function send(AuthenticatableContract $model, $subject = null)
7068
/**
7169
* Process the token verification.
7270
*
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
7674
*/
7775
public function process(AuthenticatableContract $model, $token)
7876
{
79-
if ( ! $this->compareToken($model->verification_token, $token)) {
77+
if (! $this->compareToken($model->verification_token, $token)) {
8078
return false;
8179
}
8280

@@ -88,8 +86,8 @@ public function process(AuthenticatableContract $model, $token)
8886
/**
8987
* Check if the user is verified.
9088
*
91-
* @param \Illuminate\Contracts\Auth\Authenticatable $model
92-
* @return boolean
89+
* @param \Illuminate\Contracts\Auth\Authenticatable $model
90+
* @return bool
9391
*/
9492
public function isVerified(AuthenticatableContract $model)
9593
{
@@ -99,7 +97,7 @@ public function isVerified(AuthenticatableContract $model)
9997
/**
10098
* Update and save the model instance has verified.
10199
*
102-
* @param AuthenticatableContract $model
100+
* @param AuthenticatableContract $model
103101
* @return void
104102
*/
105103
protected function wasVerified(AuthenticatableContract $model)
@@ -114,9 +112,9 @@ protected function wasVerified(AuthenticatableContract $model)
114112
/**
115113
* Compare the verification token given by the user with the one stored.
116114
*
117-
* @param string $storedToken
118-
* @param string $requestToken
119-
* @return boolean
115+
* @param string $storedToken
116+
* @param string $requestToken
117+
* @return bool
120118
*/
121119
protected function compareToken($storedToken, $requestToken)
122120
{
@@ -126,8 +124,8 @@ protected function compareToken($storedToken, $requestToken)
126124
/**
127125
* Prepare and send the email with the verification token link.
128126
*
129-
* @param \Illuminate\Contracts\Auth\Authenticatable $model
130-
* @param string $subject
127+
* @param \Illuminate\Contracts\Auth\Authenticatable $model
128+
* @param string $subject
131129
* @return mixed
132130
*/
133131
protected function emailVerificationLink(AuthenticatableContract $model, $subject)
@@ -152,15 +150,16 @@ protected function generateToken()
152150
/**
153151
* Update and save the model instance with the verification token.
154152
*
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+
*
158157
* @throws \Jrean\UserVerification\Exceptions\VerificationException
159158
*/
160159
protected function saveToken(AuthenticatableContract $model, $token)
161160
{
162-
if ( ! $this->isCompliant($model)) {
163-
throw new VerificationException;
161+
if (! $this->isCompliant($model)) {
162+
throw new VerificationException();
164163
}
165164

166165
$model->verification_token = $token;
@@ -172,12 +171,11 @@ protected function saveToken(AuthenticatableContract $model, $token)
172171
* Determine if the given model table has the verified and verification_token
173172
* columns.
174173
*
175-
* @param \Illuminate\Contracts\Auth\Authenticatable $model
176-
* @return boolean
174+
* @param \Illuminate\Contracts\Auth\Authenticatable $model
175+
* @return bool
177176
*/
178177
protected function isCompliant(AuthenticatableContract $model)
179178
{
180-
return false;
181179
if (
182180
$this->hasColumn($model, 'verified')
183181
&& $this->hasColumn($model, 'verification_token')
@@ -191,9 +189,9 @@ protected function isCompliant(AuthenticatableContract $model)
191189
/**
192190
* Check if the given model talbe has the given column.
193191
*
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
197195
*/
198196
protected function hasColumn(AuthenticatableContract $model, $column)
199197
{

src/UserVerificationServiceProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public function register()
2020
/**
2121
* Register the user verification.
2222
*
23-
* @param \Illuminate\Contracts\Foundation\Application $app
24-
*
23+
* @param \Illuminate\Contracts\Foundation\Application $app
2524
* @return void
2625
*/
2726
protected function registerUserVerification(Application $app)

0 commit comments

Comments
 (0)