Code Duplication    Length = 5-6 lines in 3 locations

includes/api/ApiQueryExternalLinks.php 1 location

@@ 82-87 (lines=6) @@
79
80
		$count = 0;
81
		foreach ( $res as $row ) {
82
			if ( ++$count > $params['limit'] ) {
83
				// We've reached the one extra which shows that
84
				// there are additional pages to be had. Stop here...
85
				$this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
86
				break;
87
			}
88
			$entry = [];
89
			$to = $row->el_to;
90
			// expand protocol-relative urls

includes/api/ApiQueryQueryPage.php 1 location

@@ 92-96 (lines=5) @@
89
		$count = 0;
90
		$titles = [];
91
		foreach ( $res as $row ) {
92
			if ( ++$count > $params['limit'] ) {
93
				// We've had enough
94
				$this->setContinueEnumParameter( 'offset', $params['offset'] + $params['limit'] );
95
				break;
96
			}
97
98
			$title = Title::makeTitle( $row->namespace, $row->title );
99
			if ( is_null( $resultPageSet ) ) {

includes/api/ApiQuerySearch.php 1 location

@@ 148-153 (lines=6) @@
145
		$limit = $params['limit'];
146
147
		while ( $result ) {
148
			if ( ++$count > $limit ) {
149
				// We've reached the one extra which shows that there are
150
				// additional items to be had. Stop here...
151
				$this->setContinueEnumParameter( 'offset', $params['offset'] + $params['limit'] );
152
				break;
153
			}
154
155
			// Silently skip broken and missing titles
156
			if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {