Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 359-362 (lines=4) @@
356
		case 'string' :
357
			// Fallback string -> array, or for string -> object
358
			if ( is_array( $value ) || is_object( $value ) ) {
359
				if ( !empty( $types[0] ) ) {
360
					$next_type = array_shift( $types );
361
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
362
				}
363
			}
364
365
			// Fallback string -> false
@@ 403-408 (lines=6) @@
400
			// nobreak
401
		case 'array' :
402
			// Fallback array -> string
403
			if ( is_string( $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
			if ( isset( $type['children'] ) ) {
411
				$children = array();