Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 418-423 (lines=6) @@
415
			}
416
417
			// Fallback string -> false
418
			if ( !is_string( $value ) ) {
419
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
420
					$next_type = array_shift( $types );
421
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
422
				}
423
			}
424
			$return[$key] = (string) $value;
425
			break;
426
		case 'html' :
@@ 497-501 (lines=5) @@
494
			break;
495
		case 'object' :
496
			// Fallback object -> false
497
			if ( is_scalar( $value ) || is_null( $value ) ) {
498
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
499
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
500
				}
501
			}
502
503
			if ( isset( $type['children'] ) ) {
504
				$children = array();