Total Complexity | 3 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ContactForm extends Model |
||
11 | { |
||
12 | public $name; |
||
13 | public $email; |
||
14 | public $subject; |
||
15 | public $body; |
||
16 | public $verifyCode; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | public function rules() |
||
22 | { |
||
23 | return [ |
||
24 | // name, email, subject and body are required |
||
25 | [['name', 'email', 'subject', 'body'], 'required'], |
||
26 | // email has to be a valid email address |
||
27 | ['email', 'email'], |
||
28 | // verifyCode needs to be entered correctly |
||
29 | ['verifyCode', 'captcha'], |
||
30 | ]; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function attributeLabels() |
||
37 | { |
||
38 | return [ |
||
39 | 'verifyCode' => 'Verification Code', |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Sends an email to the specified email address using the information collected by this model. |
||
45 | * |
||
46 | * @param string $email the target email address |
||
47 | * @return bool whether the email was sent |
||
48 | */ |
||
49 | public function sendEmail($email) |
||
59 | } |
||
60 | } |
||
61 |