Customer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 5 1
A messages() 0 5 1
1
<?php
2
3
namespace Cube\SilverStripe\Validation\Tests\Stub;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\ORM\DataObject;
7
use Cube\SilverStripe\Validation\Interfaces\ValidationRules;
8
9
/**
10
 * Class Customer
11
 * @package Cube\SilverStripe\Validation\Tests\Stub
12
 */
13
class Customer extends DataObject implements TestOnly, ValidationRules
14
{
15
    /**
16
     * @var string[]
17
     */
18
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
19
        'Name' => 'Varchar(255)',
20
        'Company' => 'Varchar(255)'
21
    ];
22
23
    /**
24
     * @return array
25
     */
26
    public function rules() : array
27
    {
28
        return [
29
            'Name' => 'required',
30
            'Company' => 'required'
31
        ];
32
    }
33
34
    /**
35
     * @return string[][]
36
     */
37
    public function messages() : array
38
    {
39
        return [
40
            'Company' => [
41
                'required' => 'You need to work at a company.'
42
            ]
43
        ];
44
    }
45
}
46