Code Duplication    Length = 4-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 378-381 (lines=4) @@
375
		case 'string' :
376
			// Fallback string -> array, or for string -> object
377
			if ( is_array( $value ) || is_object( $value ) ) {
378
				if ( !empty( $types[0] ) ) {
379
					$next_type = array_shift( $types );
380
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
381
				}
382
			}
383
384
			// Fallback string -> false
@@ 423-428 (lines=6) @@
420
			// nobreak
421
		case 'array' :
422
			// Fallback array -> string
423
			if ( is_string( $value ) ) {
424
				if ( !empty( $types[0] ) ) {
425
					$next_type = array_shift( $types );
426
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
427
				}
428
			}
429
430
			if ( isset( $type['children'] ) ) {
431
				$children = array();