Passed
Push — master ( 4c5faf...429320 )
by Chris
04:23
created

AbstractRestrictedFormDataProcessor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 3
cts 4
cp 0.75
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A addField() 0 7 2
1
<?php
2
3
namespace WebTheory\Saveyour\Processors;
4
5
use WebTheory\Saveyour\Contracts\FormDataProcessorInterface;
6
7
abstract class AbstractRestrictedFormDataProcessor extends AbstractFormDataProcessor implements FormDataProcessorInterface
8
{
9
    /**
10
     *
11
     */
12
    public const ACCEPTED_FIELDS = [];
13
14
    /**
15
     *
16
     */
17 3
    public function addField(string $field, string $param)
18
    {
19 3
        if (!in_array($field, static::ACCEPTED_FIELDS, true)) {
20
            throw new \InvalidArgumentException("{$field} is not an accepted value");
21
        }
22
23 3
        return parent::addField($field, $param);
24
    }
25
}
26