GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 910697...1f0e95 )
by Dane
08:58
created

sendResetLinkFailedResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
/**
3
 * Pterodactyl - Panel
4
 * Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in all
14
 * copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24
25
namespace Pterodactyl\Http\Controllers\Auth;
26
27
use Illuminate\Http\Request;
28
use Illuminate\Support\Facades\Password;
29
use Pterodactyl\Http\Controllers\Controller;
30
use Pterodactyl\Events\Auth\FailedPasswordReset;
31
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
32
33
class ForgotPasswordController extends Controller
34
{
35
    /*
36
    |--------------------------------------------------------------------------
37
    | Password Reset Controller
38
    |--------------------------------------------------------------------------
39
    |
40
    | This controller is responsible for handling password reset emails and
41
    | includes a trait which assists in sending these notifications from
42
    | your application to your users. Feel free to explore this trait.
43
    |
44
    */
45
46
    use SendsPasswordResetEmails;
47
48
    /**
49
     * Create a new controller instance.
50
     *
51
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
52
     */
53
    public function __construct()
54
    {
55
        $this->middleware('guest');
56
    }
57
58
    /**
59
     * Get the response for a failed password reset link.
60
     *
61
     * @param  \Illuminate\Http\Request
62
     * @param  string  $response
63
     * @return \Illuminate\Http\RedirectResponse
64
     */
65
    protected function sendResetLinkFailedResponse(Request $request, $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
66
    {
67
        // As noted in #358 we will return success even if it failed
68
        // to avoid pointing out that an account does or does not
69
        // exist on the system.
70
        event(new FailedPasswordReset($request->ip(), $request->only('email')));
0 ignored issues
show
Documentation introduced by
$request->only('email') is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
72
        return $this->sendResetLinkResponse(Password::RESET_LINK_SENT);
73
    }
74
}
75