Skip to content

Commit

Permalink
Icinga\Protocol\File\Reader::fetchPairs(): rename variables
Browse files Browse the repository at this point in the history
$skipLines -> $skip
$readLines -> $read

refs #7060
  • Loading branch information
Al2Klimov committed Sep 3, 2014
1 parent 88dde47 commit e45f504
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions library/Icinga/Protocol/File/Reader.php
Expand Up @@ -137,26 +137,26 @@ public function fetchAll(Query $query)
*/
public function fetchPairs(Query $query)
{
$skipLines = $query->getOffset();
$readLines = $query->getLimit();
if ($skipLines === null) {
$skipLines = 0;
$skip = $query->getOffset();
$read = $query->getLimit();
if ($skip === null) {
$skip = 0;
}
$lines = array();
if ($query->sortDesc()) {
$count = $this->count($query);
if ($count <= $skipLines) {
if ($count <= $skip) {
return $lines;
} else if ($count < ($skipLines + $readLines)) {
$readLines = $count - $skipLines;
$skipLines = 0;
} else if ($count < ($skip + $read)) {
$read = $count - $skip;
$skip = 0;
} else {
$skipLines = $count - ($skipLines + $readLines);
$skip = $count - ($skip + $read);
}
}
foreach ($this as $index => $line) {
if ($index >= $skipLines) {
if ($index >= $skipLines + $readLines) {
if ($index >= $skip) {
if ($index >= $skip + $read) {
break;
}
$lines[] = $line;
Expand Down

0 comments on commit e45f504

Please sign in to comment.