Code Duplication    Length = 16-16 lines in 3 locations

includes/api/legacy/v1/class-wc-api-server.php 1 location

@@ 513-528 (lines=16) @@
510
	 * @param string $link Target IRI for the link
511
	 * @param array $other Other parameters to send, as an associative array
512
	 */
513
	public function link_header( $rel, $link, $other = array() ) {
514
515
		$header = sprintf( '<%s>; rel="%s"', $link, esc_attr( $rel ) );
516
517
		foreach ( $other as $key => $value ) {
518
519
			if ( 'title' == $key ) {
520
521
				$value = '"' . $value . '"';
522
			}
523
524
			$header .= '; ' . $key . '=' . $value;
525
		}
526
527
		$this->header( 'Link', $header, false );
528
	}
529
530
	/**
531
	 * Send pagination headers for resources

includes/api/legacy/v2/class-wc-api-server.php 1 location

@@ 542-557 (lines=16) @@
539
	 * @param string $link Target IRI for the link
540
	 * @param array $other Other parameters to send, as an associative array
541
	 */
542
	public function link_header( $rel, $link, $other = array() ) {
543
544
		$header = sprintf( '<%s>; rel="%s"', $link, esc_attr( $rel ) );
545
546
		foreach ( $other as $key => $value ) {
547
548
			if ( 'title' == $key ) {
549
550
				$value = '"' . $value . '"';
551
			}
552
553
			$header .= '; ' . $key . '=' . $value;
554
		}
555
556
		$this->header( 'Link', $header, false );
557
	}
558
559
	/**
560
	 * Send pagination headers for resources

includes/api/legacy/v3/class-wc-api-server.php 1 location

@@ 543-558 (lines=16) @@
540
	 * @param string $link Target IRI for the link
541
	 * @param array $other Other parameters to send, as an associative array
542
	 */
543
	public function link_header( $rel, $link, $other = array() ) {
544
545
		$header = sprintf( '<%s>; rel="%s"', $link, esc_attr( $rel ) );
546
547
		foreach ( $other as $key => $value ) {
548
549
			if ( 'title' == $key ) {
550
551
				$value = '"' . $value . '"';
552
			}
553
554
			$header .= '; ' . $key . '=' . $value;
555
		}
556
557
		$this->header( 'Link', $header, false );
558
	}
559
560
	/**
561
	 * Send pagination headers for resources