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

AbstractRestrictedFormDataProcessor::addField()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

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