Code Duplication    Length = 14-15 lines in 2 locations

modules/infinite-scroll/class-jetpack-amp-infinite-scroll-sanitizer.php 2 locations

@@ 77-91 (lines=15) @@
74
	/**
75
	 * Hide next page elements.
76
	 */
77
	private function hide_next_page_elements() {
78
		if ( isset( $this->args['next_page_hide_xpaths'] ) && is_array( $this->args['next_page_hide_xpaths'] ) ) {
79
			$xpaths = $this->args['next_page_hide_xpaths'];
80
		} else {
81
			$xpaths = array();
82
		}
83
		$xpaths[] = '//div[ @id = "wpadminbar" ]';
84
85
		foreach ( $xpaths as $next_page_hide_xpath ) {
86
			/** @var DOMElement $element */
87
			foreach ( $this->xpath->query( $next_page_hide_xpath ) as $element ) {
88
				$element->setAttribute( 'next-page-hide', '' );
89
			}
90
		}
91
	}
92
93
	/**
94
	 * Hide elements on initial load.
@@ 96-109 (lines=14) @@
93
	/**
94
	 * Hide elements on initial load.
95
	 */
96
	private function hide_hidden_elements() {
97
		if ( isset( $this->args['hidden_xpaths'] ) && is_array( $this->args['hidden_xpaths'] ) ) {
98
			$xpaths = $this->args['hidden_xpaths'];
99
		} else {
100
			$xpaths = array();
101
		}
102
103
		foreach ( $xpaths as $hidden_xpath ) {
104
			/** @var DOMElement $element */
105
			foreach ( $this->xpath->query( $hidden_xpath ) as $element ) {
106
				$element->setAttribute( 'hidden', '' );
107
			}
108
		}
109
	}
110
}
111