Passed
Push — master ( bba981...a1f61b )
by Stephen
02:25
created

HoneyCaughtResponder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A respond() 0 7 1
1
<?php
2
3
namespace Sfneal\Honeypot\Responders;
4
5
use Closure;
6
use Illuminate\Contracts\Routing\ResponseFactory;
7
use Illuminate\Http\Request;
8
use Illuminate\Http\Response;
9
use Sfneal\Honeypot\SpamResponder\SpamResponder;
0 ignored issues
show
Bug introduced by
The type Sfneal\Honeypot\SpamResponder\SpamResponder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Sfneal\Honeypot\Actions\TrackSpamAction;
11
12
class HoneyCaughtResponder implements SpamResponder
13
{
14
    /**
15
     * Provide an HTTP response to a spam request caught in the honeypot.
16
     *
17
     * @param Request $request
18
     * @param Closure $next
19
     *
20
     * @return ResponseFactory|Response
21
     */
22
    public function respond(Request $request, Closure $next)
23
    {
24
        // Track the Spam
25
        (new TrackSpamAction($request))->execute();
26
27
        // Return response
28
        return response("If you're a robot, you've been caught by a human.  If you're a human, another human has mistaken you for a robot.");
29
    }
30
}
31