Passed
Push — 4 ( 34eb17...84b405 )
by Robbie
08:27 queued 12s
created

TestValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A php() 0 7 2
A getForm() 0 3 1
1
<?php
2
3
namespace SilverStripe\Forms\Tests\ValidatorTest;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\Forms\Form;
7
use SilverStripe\Forms\Validator;
8
9
class TestValidator extends Validator implements TestOnly
10
{
11
12
    /**
13
     * Requires a specific field for test purposes.
14
     *
15
     * @param array $data
16
     * @return null
17
     */
18
    public function php($data)
19
    {
20
        foreach ($data as $field => $data) {
0 ignored issues
show
introduced by
$data is overwriting one of the parameters of this function.
Loading history...
21
            $this->validationError($field, 'error');
22
        }
23
24
        return null;
25
    }
26
27
    /**
28
     * Allow us to access the form for test purposes.
29
     *
30
     * @return Form|null
31
     */
32
    public function getForm(): ?Form
33
    {
34
        return $this->form;
35
    }
36
}
37