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

TokenSubmit::getSubmitted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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