mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Icinga\Protocol\File\FileReader: use Icinga\Util\Enumerate
This commit is contained in:
parent
982cda6805
commit
52c1d98beb
@ -6,6 +6,7 @@ namespace Icinga\Protocol\File;
|
|||||||
|
|
||||||
use Icinga\Data\Selectable;
|
use Icinga\Data\Selectable;
|
||||||
use Countable;
|
use Countable;
|
||||||
|
use Icinga\Util\Enumerate;
|
||||||
use Zend_Config;
|
use Zend_Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +53,9 @@ class FileReader implements Selectable, Countable
|
|||||||
*/
|
*/
|
||||||
public function iterate()
|
public function iterate()
|
||||||
{
|
{
|
||||||
return new FileIterator($this->filename, $this->fields);
|
return new Enumerate(
|
||||||
|
new FileIterator($this->filename, $this->fields)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,15 +120,13 @@ class FileReader implements Selectable, Countable
|
|||||||
$skip = $count - ($skip + $read);
|
$skip = $count - ($skip + $read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$index = 0;
|
foreach ($this->iterate() as $index => $line) {
|
||||||
foreach ($this->iterate() as $line) {
|
|
||||||
if ($index >= $skip) {
|
if ($index >= $skip) {
|
||||||
if ($index >= $skip + $read) {
|
if ($index >= $skip + $read) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$lines[] = $line;
|
$lines[] = $line;
|
||||||
}
|
}
|
||||||
++$index;
|
|
||||||
}
|
}
|
||||||
if ($query->sortDesc()) {
|
if ($query->sortDesc()) {
|
||||||
$lines = array_reverse($lines);
|
$lines = array_reverse($lines);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user