Code Duplication    Length = 5-6 lines in 2 locations

class.json-api-endpoints.php 2 locations

@@ 363-368 (lines=6) @@
360
			}
361
362
			// Fallback string -> false
363
			if ( !is_string( $value ) ) {
364
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
365
					$next_type = array_shift( $types );
366
					return $this->cast_and_filter_item( $return, $next_type, $key, $value, $types, $for_output );
367
				}
368
			}
369
			$return[$key] = (string) $value;
370
			break;
371
		case 'html' :
@@ 441-445 (lines=5) @@
438
			break;
439
		case 'object' :
440
			// Fallback object -> false
441
			if ( is_scalar( $value ) || is_null( $value ) ) {
442
				if ( !empty( $types[0] ) && 'false' === $types[0]['type'] ) {
443
					return $this->cast_and_filter_item( $return, 'false', $key, $value, $types, $for_output );
444
				}
445
			}
446
447
			if ( isset( $type['children'] ) ) {
448
				$children = array();