Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 373-378 (lines=6) @@
370
			}
371
372
			// Fallback string -> false
373
			if ( !is_string( $value ) ) {
374
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
375
					$next_type = array_shift( $types );
376
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
377
				}
378
			}
379
			$return[$key] = (string) $value;
380
			break;
381
		case 'html' :
@@ 451-455 (lines=5) @@
448
			break;
449
		case 'object' :
450
			// Fallback object -> false
451
			if ( is_scalar( $value ) || is_null( $value ) ) {
452
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
453
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
454
				}
455
			}
456
457
			if ( isset( $type['children'] ) ) {
458
				$children = array();