Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 394-399 (lines=6) @@
391
			}
392
393
			// Fallback string -> false
394
			if ( !is_string( $value ) ) {
395
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
396
					$next_type = array_shift( $types );
397
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
398
				}
399
			}
400
			$return[$key] = (string) $value;
401
			break;
402
		case 'html' :
@@ 473-477 (lines=5) @@
470
			break;
471
		case 'object' :
472
			// Fallback object -> false
473
			if ( is_scalar( $value ) || is_null( $value ) ) {
474
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
475
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
476
				}
477
			}
478
479
			if ( isset( $type['children'] ) ) {
480
				$children = array();