Code Duplication    Length = 15-16 lines in 2 locations

includes/api/ApiQueryLogEvents.php 1 location

@@ 224-238 (lines=15) @@
221
		$count = 0;
222
		$res = $this->select( __METHOD__ );
223
		$result = $this->getResult();
224
		foreach ( $res as $row ) {
225
			if ( ++$count > $limit ) {
226
				// We've reached the one extra which shows that there are
227
				// additional pages to be had. Stop here...
228
				$this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
229
				break;
230
			}
231
232
			$vals = $this->extractRowInfo( $row );
233
			$fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
234
			if ( !$fit ) {
235
				$this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
236
				break;
237
			}
238
		}
239
		$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'item' );
240
	}
241

includes/api/ApiQueryPagePropNames.php 1 location

@@ 64-79 (lines=16) @@
61
62
		$result = $this->getResult();
63
		$count = 0;
64
		foreach ( $this->select( __METHOD__ ) as $row ) {
65
			if ( ++$count > $limit ) {
66
				// We've reached the one extra which shows that there are
67
				// additional pages to be had. Stop here...
68
				$this->setContinueEnumParameter( 'continue', $row->pp_propname );
69
				break;
70
			}
71
72
			$vals = [];
73
			$vals['propname'] = $row->pp_propname;
74
			$fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
75
			if ( !$fit ) {
76
				$this->setContinueEnumParameter( 'continue', $row->pp_propname );
77
				break;
78
			}
79
		}
80
81
		$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'p' );
82
	}