Code Duplication    Length = 12-12 lines in 2 locations

includes/api/legacy/v1/class-wc-api-server.php 2 locations

@@ 728-739 (lines=12) @@
725
	 * @since 2.1
726
	 * @return bool
727
	 */
728
	private function is_json_request() {
729
730
		// check path
731
		if ( false !== stripos( $this->path, '.json' ) )
732
			return true;
733
734
		// check ACCEPT header, only 'application/json' is acceptable, see RFC 4627
735
		if ( isset( $this->headers['ACCEPT'] ) && 'application/json' == $this->headers['ACCEPT'] )
736
			return true;
737
738
		return false;
739
	}
740
741
	/**
742
	 * Check if the current request accepts an XML response by checking the endpoint suffix (.xml) or
@@ 748-759 (lines=12) @@
745
	 * @since 2.1
746
	 * @return bool
747
	 */
748
	private function is_xml_request() {
749
750
		// check path
751
		if ( false !== stripos( $this->path, '.xml' ) )
752
			return true;
753
754
		// check headers, 'application/xml' or 'text/xml' are acceptable, see RFC 2376
755
		if ( isset( $this->headers['ACCEPT'] ) && ( 'application/xml' == $this->headers['ACCEPT'] || 'text/xml' == $this->headers['ACCEPT'] ) )
756
			return true;
757
758
		return false;
759
	}
760
}
761