jumper423 / file-iterator
file iterator
1.0.1
2016-10-11 22:46 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2024-11-05 19:20:11 UTC
README
Дан текстовый файл размером 2ГБ. Напишите класс, реализующий интерфейс SeekableIterator, для чтения данного файла.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist jumper423/file-iterator
or add
"jumper423/yfile-iterator": "*"
to the require
section of your composer.json.
Usage & Documentation
$fileIterator = new \jumper423\FileIterator(__DIR__ . '/file'); $fileIterator->rewind(); $fileIterator->next(); $fileIterator->next(); $fileIterator->seek(3); $fileIterator->next(); echo $fileIterator->current(); $fileIterator->next(); echo $fileIterator->current(); $fileIterator->seek(9); $fileIterator->next(); $fileIterator->next(); if ($fileIterator->valid()) { ... }
Tests
vendor/bin/phpunit