Completed
Push — master ( 054192...eb3219 )
by Torben
02:56 queued 01:47
created

HoneypotSpamCheck   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isFailed() 0 7 2
1
<?php
2
declare(strict_types=1);
3
namespace DERHANSEN\SfEventMgt\SpamChecks;
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
/**
13
 * HoneypotSpamCheck
14
 */
15
class HoneypotSpamCheck extends AbstractSpamCheck
16
{
17
    /**
18
     * Check is failed, if expected honeypot field is not present in arguments or if expected field
19
     * contains a value
20
     *
21
     * @return bool
22
     */
23
    public function isFailed(): bool
24
    {
25
        $honeypotField = 'hp' . $this->arguments['event'];
26
27
        return !isset($this->arguments['registration'][$honeypotField]) ||
28
            $this->arguments['registration'][$honeypotField] !== '';
29
    }
30
}
31