Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

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