Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — development ( 3ead65...58197d )
by José
04:21
created

PasswordResetController::recover()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 23
ccs 0
cts 13
cp 0
rs 9.0856
cc 3
eloc 14
nc 3
nop 1
crap 12
1
<?php
2
3
namespace DoeSangue\Http\Controllers\Auth\V1;
4
5
use Illuminate\Http\Request;
6
use DoeSangue\Http\Controllers\Controller;
7
use DoeSangue\Models\User;
8
use Illuminate\Support\Facades\Password;
9
10
class PasswordResetController extends Controller
11
{
12
    /**
13
     * Password recover
14
     *
15
     * @param Request $request
16
     * @return \Illuminate\Http\JsonResponse
17
     */
18
    public function recover(Request $request)
19
    {
20
      $user = User::where('email', $request->email)->first();
21
      if (!$user) {
22
        $error_message = "Your email address was not found.";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Your email address was not found. does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
23
        return response()->json([ 'success' => false, 'error' => [ 'email' => $error_message ] ], 401);
24
      }
25
26
      try {
27
        Password::sendResetLink($request->only('email'), function(Message $message) {
28
          $message->subject('Your Password Reset Link');
29
        });
30
      } catch (Exception $e) {
0 ignored issues
show
Bug introduced by
The class DoeSangue\Http\Controllers\Auth\V1\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
31
        // Return with error
32
        $error_message = $e->getMessage();
33
        return response()->json([ 'success' => false, 'error' => $error_message ], 401);
34
      }
35
36
      return response()->json([
37
        'success' => true,
38
        'data' => [ 'message' => 'A reset email has been sent! Please check your email.' ]
39
        ]);
40
    }
41
}
42