Passed
Push — 5.x ( 4d7971...bef106 )
by Enjoys
02:40
created

TokenSubmit   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubmitted() 0 5 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\Form;
8
9
class TokenSubmit extends Hidden
10
{
11
    private string $token;
12
13 80
    public function __construct(string $token)
14
    {
15 80
        $this->token = $token;
16 80
        parent::__construct(Form::_TOKEN_SUBMIT_, $this->token);
17
    }
18
19 80
    public function getSubmitted(): bool
20
    {
21 80
        $rule = new \Enjoys\Forms\Rule\Submit($this->token);
22 80
        $rule->setRequest($this->getRequest());
23 80
        return $rule->validate($this);
24
    }
25
}
26