Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 435-440 (lines=6) @@
432
				}
433
434
				// Fallback string -> false
435
				if ( ! is_string( $value ) ) {
436
					if ( ! empty( $types[0] ) && 'false' === $types[0]['type'] ) {
437
						$next_type = array_shift( $types );
438
						return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
439
					}
440
				}
441
				$return[ $key ] = (string) $value;
442
				break;
443
			case 'html':
@@ 514-518 (lines=5) @@
511
				break;
512
			case 'object':
513
				// Fallback object -> false
514
				if ( is_scalar( $value ) || is_null( $value ) ) {
515
					if ( ! empty( $types[0] ) && 'false' === $types[0]['type'] ) {
516
						return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
517
					}
518
				}
519
520
				if ( isset( $type['children'] ) ) {
521
					$children = array();