| Total Complexity | 7 | 
| Total Lines | 45 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 8 | class HoneyPot  | 
            ||
| 9 | { | 
            ||
| 10 | /**  | 
            ||
| 11 | * Handle an incoming request.  | 
            ||
| 12 | *  | 
            ||
| 13 | * @param \Illuminate\Http\Request $request  | 
            ||
| 14 | * @param \Closure $next  | 
            ||
| 15 | * @return mixed  | 
            ||
| 16 | */  | 
            ||
| 17 | public function handle($request, Closure $next)  | 
            ||
| 23 | }  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * Honeypot field protection  | 
            ||
| 27 | *  | 
            ||
| 28 | * A hidden field in the comment form is tagged as honeypot.  | 
            ||
| 29 | * Should this field be filled with data or if this field is removed  | 
            ||
| 30 | * from the input, We can assume the submit is forged.  | 
            ||
| 31 | *  | 
            ||
| 32 | * A field with the attribute key of your_name is assumed  | 
            ||
| 33 | */  | 
            ||
| 34 | private function honeypot(Request $request)  | 
            ||
| 35 |     { | 
            ||
| 36 |         if (!$request->exists('your_name') or $request->has('your_name')) { | 
            ||
| 37 |             abort('403', 'Request blocked due to assumed spam attempt. Honeypot field was filled in.'); | 
            ||
| 38 | }  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | /**  | 
            ||
| 42 | * Timer lock  | 
            ||
| 43 | *  | 
            ||
| 44 | * Should the request be performed in less then 3 seconds  | 
            ||
| 45 | * A automatic spam submit is assumed.  | 
            ||
| 46 | * Validation is performed by setting a timestamp  | 
            ||
| 47 | * at the time of the comment form creation  | 
            ||
| 48 | */  | 
            ||
| 49 | private function timer(Request $request)  | 
            ||
| 53 | }  | 
            ||
| 54 | }  | 
            ||
| 56 |