Code Duplication    Length = 21-21 lines in 2 locations

src/Model/Table/ConversationsTable.php 2 locations

@@ 52-72 (lines=21) @@
49
     * @param \Cake\Validation\Validator $validator Validator instance.
50
     * @return \Cake\Validation\Validator
51
     */
52
    public function validationCreate(Validator $validator)
53
    {
54
        $validator
55
            ->provider('purifier', 'App\Model\Validation\PurifierValidator')
56
            ->notEmpty('title', __d('conversations', 'You must specify a title for your conversation.'))
57
            ->add('title', 'minLength', [
58
                'rule' => ['minLength', 5],
59
                'message' => __d('conversations', 'Your title must contain at least {0} characters.', 5)
60
            ])
61
62
            ->notEmpty('message', __d('conversations', 'You must specify a message for your conversation.'))
63
            ->add('message', [
64
                'purifierMinLength' => [
65
                    'rule' => ['purifierMinLength', 5],
66
                    'provider' => 'purifier',
67
                    'message' => __d('conversations', 'Your message must contain at least {0} characters.', 5)
68
                ]
69
            ]);
70
71
        return $validator;
72
    }
73
74
    /**
75
     * Edit validation rules.
@@ 80-100 (lines=21) @@
77
     * @param \Cake\Validation\Validator $validator Validator instance.
78
     * @return \Cake\Validation\Validator
79
     */
80
    public function validationEdit(Validator $validator)
81
    {
82
        $validator
83
            ->provider('purifier', 'App\Model\Validation\PurifierValidator')
84
            ->notEmpty('title', __d('conversations', 'You must specify a title for your conversation.'))
85
            ->add('title', 'minLength', [
86
                'rule' => ['minLength', 5],
87
                'message' => __d('conversations', 'Your title must contain at least {0} characters.', 5)
88
            ])
89
90
            ->notEmpty('message', __d('conversations', 'You must specify a message for your conversation.'))
91
            ->add('message', [
92
                'purifierMinLength' => [
93
                    'rule' => ['purifierMinLength', 5],
94
                    'provider' => 'purifier',
95
                    'message' => __d('conversations', 'Your message must contain at least {0} characters.', 5)
96
                ]
97
            ]);
98
99
        return $validator;
100
    }
101
}
102