HoneypotSpamCheck   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A isFailed() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\SpamChecks;
13
14
class HoneypotSpamCheck extends AbstractSpamCheck
15
{
16
    /**
17
     * Check is failed, if expected honeypot field is not present in arguments or if expected field
18
     * contains a value
19
     */
20
    public function isFailed(): bool
21
    {
22
        $honeypotField = 'hp' . ($this->arguments['event'] ?? 0);
23
24
        return !isset($this->arguments['registration'][$honeypotField]) ||
25
            ($this->arguments['registration'][$honeypotField] ?? 'spam') !== '';
26
    }
27
}
28