Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 399-402 (lines=4) @@
396
		case 'string' :
397
			// Fallback string -> array, or for string -> object
398
			if ( is_array( $value ) || is_object( $value ) ) {
399
				if ( !empty( $types[0] ) ) {
400
					$next_type = array_shift( $types );
401
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
402
				}
403
			}
404
405
			// Fallback string -> false
@@ 444-449 (lines=6) @@
441
			// nobreak
442
		case 'array' :
443
			// Fallback array -> string
444
			if ( is_string( $value ) ) {
445
				if ( !empty( $types[0] ) ) {
446
					$next_type = array_shift( $types );
447
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
448
				}
449
			}
450
451
			if ( isset( $type['children'] ) ) {
452
				$children = array();