Code Duplication    Length = 10-10 lines in 2 locations

classes/PodsAPI.php 2 locations

@@ 3458-3467 (lines=10) @@
3455
                        $value = array_slice( $value, 0, $pick_limit );
3456
3457
                    // Don't save an empty array, just make it an empty string
3458
                    if ( empty( $value ) )
3459
                        $value = '';
3460
                    elseif ( is_array( $value ) ) {
3461
                        // If there's just one item, don't save as an array, save the string
3462
                        if ( 1 == $pick_limit || 1 == count( $value ) )
3463
                            $value = implode( '', $value );
3464
                        // If storage is set to table, json encode, otherwise WP will serialize automatically
3465
                        elseif ( 'table' == pods_var( 'storage', $pod ) )
3466
                            $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value );
3467
                    }
3468
                }
3469
3470
                // Prepare all table / meta data
@@ 3474-3483 (lines=10) @@
3471
                if ( !in_array( $type, $tableless_field_types ) || $simple ) {
3472
                    if ( in_array( $type, $repeatable_field_types ) && 1 == pods_var( $type . '_repeatable', $field_data, 0 ) ) {
3473
                        // Don't save an empty array, just make it an empty string
3474
                        if ( empty( $value ) )
3475
                            $value = '';
3476
                        elseif ( is_array( $value ) ) {
3477
                            // If there's just one item, don't save as an array, save the string
3478
                            if ( 1 == count( $value ) )
3479
                                $value = implode( '', $value );
3480
                            // If storage is set to table, json encode, otherwise WP will serialize automatically
3481
                            elseif ( 'table' == pods_var( 'storage', $pod ) )
3482
                                $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value );
3483
                        }
3484
                    }
3485
3486
                    $table_data[ $field ] = str_replace( array( '{prefix}', '@wp_' ), array( '{/prefix/}', '{prefix}' ), $value ); // Fix for pods_query