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
Pull Request — development (#51)
by José
04:30
created

PasswordResetController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 32
ccs 0
cts 13
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A recover() 0 23 3
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