Issues (22)

src/Captcha/CaptchaAbstract.php (2 issues)

Severity
1
<?php
2
3
namespace WebDevEtc\BlogEtc\Captcha;
4
5
use Illuminate\Http\Request;
6
use WebDevEtc\BlogEtc\Interfaces\CaptchaInterface;
7
use WebDevEtc\BlogEtc\Models\Post;
8
9
/**
10
 * Class CaptchaAbstract.
11
 */
12
abstract class CaptchaAbstract implements CaptchaInterface
13
{
14
    /**
15
     * executed when viewing single post.
16
     */
17
    public function runCaptchaBeforeShowingPosts(/** @scrutinizer ignore-unused */ Request $request, /** @scrutinizer ignore-unused */ Post $blogEtcPost)
18
    {
19
        /*
20
        No code here to run! Maybe in your subclass you can make use of this?
21
22
        But you could put something like this -
23
        $some_question = ...
24
        $correct_captcha = ...
25
        View::share("correct_captcha", $someQuestion); // << reference this in the view file.
26
        Session::put("correct_captcha",$correctCaptcha);
27
28
        ...then in the validation rules you can check if the submitted value matched the above value.
29
        */
30
    }
31
32
    /**
33
     * executed when posting new comment.
34
     */
35
    public function runCaptchaBeforeAddingComment(Request $request, Post $blogEtcPost)
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function runCaptchaBeforeAddingComment(/** @scrutinizer ignore-unused */ Request $request, Post $blogEtcPost)

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

Loading history...
The parameter $blogEtcPost is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function runCaptchaBeforeAddingComment(Request $request, /** @scrutinizer ignore-unused */ Post $blogEtcPost)

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

Loading history...
36
    {
37
        // no code here to run! Maybe in your subclass you can make use of this?
38
    }
39
}
40