Code Duplication    Length = 19-19 lines in 2 locations

classes/fields/password.php 1 location

@@ 151-169 (lines=19) @@
148
     * @return array|bool
149
     * @since 2.0
150
     */
151
    public function validate ( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
152
        $errors = array();
153
154
        $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
155
156
        if ( is_array( $check ) )
157
            $errors = $check;
158
        else {
159
            if ( 0 < strlen( $value ) && strlen( $check ) < 1 ) {
160
                if ( 1 == pods_var( 'required', $options ) )
161
                    $errors[] = __( 'This field is required.', 'pods' );
162
            }
163
        }
164
165
        if ( !empty( $errors ) )
166
            return $errors;
167
168
        return true;
169
    }
170
171
    /**
172
     * Change the value or perform actions after validation but before saving to the DB

classes/fields/text.php 1 location

@@ 203-221 (lines=19) @@
200
     * @return array|bool
201
     * @since 2.0
202
     */
203
    public function validate ( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
204
        $errors = array();
205
206
        $check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
207
208
        if ( is_array( $check ) )
209
            $errors = $check;
210
        else {
211
            if ( 0 < strlen( $value ) && strlen( $check ) < 1 ) {
212
                if ( 1 == pods_var( 'required', $options ) )
213
                    $errors[] = __( 'This field is required.', 'pods' );
214
            }
215
        }
216
217
        if ( !empty( $errors ) )
218
            return $errors;
219
220
        return true;
221
    }
222
223
    /**
224
     * Change the value or perform actions after validation but before saving to the DB