Passed
Push — master ( fc5e69...5c28dc )
by Wilmer
05:31
created

ContactForm   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0
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
     * @return array the validation rules
24
     **/
25
    public function rules(): array
26
    {
27
        return [
28
            // name, email, subject and body are required
29
            [['name', 'email', 'subject', 'body'], 'required'],
30
            // email has to be a valid email address
31
            ['email', 'email'],
32
            // verifyCode needs to be entered correctly
33
            ['verifyCode', \Yiisoft\Yii\Captcha\CaptchaValidator::class],
34
        ];
35
    }
36
}
37