Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 404-407 (lines=4) @@
401
		case 'string' :
402
			// Fallback string -> array, or for string -> object
403
			if ( is_array( $value ) || is_object( $value ) ) {
404
				if ( !empty( $types[0] ) ) {
405
					$next_type = array_shift( $types );
406
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
407
				}
408
			}
409
410
			// Fallback string -> false
@@ 449-454 (lines=6) @@
446
			// nobreak
447
		case 'array' :
448
			// Fallback array -> string
449
			if ( is_string( $value ) ) {
450
				if ( !empty( $types[0] ) ) {
451
					$next_type = array_shift( $types );
452
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
453
				}
454
			}
455
456
			if ( isset( $type['children'] ) ) {
457
				$children = array();