Passed
Push — master ( 3596af...da6412 )
by Wilmer
02:03
created

ContactForm::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace app\basic\forms;
4
5
use yii\base\Model;
6
use yii\helpers\Yii;
7
8
/**
9
 * ContactForm is the model behind the contact form Web Application Basic.
10
 **/
11
class ContactForm extends Model
12
{
13
	public $name;
14
	public $email;
15
	public $subject;
16
	public $body;
17
	public $verifyCode;
18
19
	/**
20
     * rules
21
     *
22
	 * @return array the validation rules.
23
	 **/
24
	public function rules()
25
	{
26
		return [
27
			// name, email, subject and body are required
28
			[['name', 'email', 'subject', 'body'], 'required'],
29
			// email has to be a valid email address
30
			['email', 'email'],
31
			// verifyCode needs to be entered correctly
32
			//['verifyCode', \yii\captcha\CaptchaValidator::class],
33
		];
34
	}
35
36
	/**
37
     * attributeLabels
38
	 * Translate Atribute Labels.
39
     *
40
	 * @return array customized attribute labels.
41
	 **/
42
	public function attributeLabels()
43
	{
44
		return [
45
			'body' => Yii::t('basic', 'Body'),
46
			'email' => Yii::t('basic', 'Email'),
47
			'name' => Yii::t('basic', 'Name'),
48
			'password' => Yii::t('basic', 'Password'),
49
			'subject' => Yii::t('basic', 'Subject'),
50
			'verifyCode' => Yii::t('basic', 'VerifyCode'),
51
		];
52
	}
53
}
54