Code Duplication    Length = 11-11 lines in 2 locations

lib/endpoints/class-wp-rest-posts-controller.php 1 location

@@ 686-696 (lines=11) @@
683
	 * @param string|null  $date
684
	 * @return string|null ISO8601/RFC3339 formatted datetime.
685
	 */
686
	protected function prepare_date_response( $date_gmt, $date = null ) {
687
		// Use the date if passed.
688
		if ( isset( $date ) ) {
689
			return mysql_to_rfc3339( $date );
690
		}
691
692
		// Return null if $date_gmt is empty/zeros.
693
		if ( '0000-00-00 00:00:00' === $date_gmt ) {
694
			return null;
695
		}
696
697
		// Return the formatted datetime.
698
		return mysql_to_rfc3339( $date_gmt );
699
	}

lib/endpoints/class-wp-rest-revisions-controller.php 1 location

@@ 279-289 (lines=11) @@
276
	 * @param string|null  $date
277
	 * @return string|null ISO8601/RFC3339 formatted datetime.
278
	 */
279
	protected function prepare_date_response( $date_gmt, $date = null ) {
280
		if ( '0000-00-00 00:00:00' === $date_gmt ) {
281
			return null;
282
		}
283
284
		if ( isset( $date ) ) {
285
			return mysql_to_rfc3339( $date );
286
		}
287
288
		return mysql_to_rfc3339( $date_gmt );
289
	}
290
291
	/**
292
	 * Get the revision's schema, conforming to JSON Schema