ContactFormOwner::_buildValidator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Saito - The Threaded Web Forum
7
 *
8
 * @copyright Copyright (c) the Saito Project Developers
9
 * @link https://github.com/Schlaefer/Saito
10
 * @license http://opensource.org/licenses/MIT
11
 */
12
13
namespace App\Form;
14
15
use Cake\Form\Schema;
16
use Cake\Validation\Validator;
17
18
class ContactFormOwner extends ContactForm
19
{
20
21
    /**
22
     * {@inheritdoc}
23
     *
24
     * @param \Cake\Form\Schema $schema The schema to customize.
25
     * @return \Cake\Form\Schema The schema to use.
26
     */
27
    protected function _buildSchema(Schema $schema)
28
    {
29
        $schema = parent::_buildSchema($schema);
30
        $schema->addField('sender_contact', 'string');
31
32
        return $schema;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     *
38
     * @param \Cake\Validation\Validator $validator The validator to customize.
39
     * @return \Cake\Validation\Validator The validator to use.
40
     */
41
    protected function _buildValidator(Validator $validator)
42
    {
43
        $validator = parent::_buildValidator($validator);
44
        $validator
0 ignored issues
show
Deprecated Code introduced by
The function Cake\Validation\Validator::notEmpty() has been deprecated: 3.7.0 Use notEmptyString(), notEmptyArray(), notEmptyFile(), notEmptyDate(), notEmptyTime() or notEmptyDateTime() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

44
        /** @scrutinizer ignore-deprecated */ $validator

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
45
            ->notEmpty('sender_contact')
46
            ->add('sender_contact', [
47
                'isEmail' => [
48
                    'rule' => ['email', true],
49
                    'message' => __('error_email_not-valid'),
50
                ],
51
            ]);
52
53
        return $validator;
54
    }
55
}
56