ContactForm   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 20
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A rules() 0 9 1
1
<?php
2
3
namespace terabytesoft\app\basic\forms;
4
5
use yii\base\Model;
6
7
/**
8
 * ContactForm.
9
 *
10
 * Model behind the contact form web application basic
11
 **/
12
class ContactForm extends Model
13
{
14
    public $name;
15
    public $email;
16
    public $subject;
17
    public $body;
18
    public $verifyCode;
19
20
    /**
21
     * rules
22
     **/
23 10
    public function rules(): array
24
    {
25
        return [
26
            // name, email, subject and body are required
27 10
            [['name', 'email', 'subject', 'body'], 'required'],
28
            // email has to be a valid email address
29
            ['email', 'email'],
30
            // verifyCode needs to be entered correctly
31
            ['verifyCode', \yii\captcha\CaptchaValidator::class],
32
        ];
33
    }
34
}
35