Code Duplication    Length = 6-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 355-360 (lines=6) @@
352
			break;
353
		case 'string' :
354
			// Fallback string -> array
355
			if ( is_array( $value ) ) {
356
				if ( !empty( $types[0] ) ) {
357
					$next_type = array_shift( $types );
358
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
359
				}
360
			}
361
362
			// Fallback string -> false
363
			if ( !is_string( $value ) ) {
@@ 400-405 (lines=6) @@
397
			// nobreak
398
		case 'array' :
399
			// Fallback array -> string
400
			if ( is_string( $value ) ) {
401
				if ( !empty( $types[0] ) ) {
402
					$next_type = array_shift( $types );
403
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
404
				}
405
			}
406
407
			if ( isset( $type['children'] ) ) {
408
				$children = array();