2017 © Pedro Peláez
 

library io-collections

I/O Collections for the XP Framework

image

xp-framework/io-collections

I/O Collections for the XP Framework

  • Sunday, May 28, 2017
  • by thekid
  • Repository
  • 2 Watchers
  • 0 Stars
  • 33,546 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 6 % Grown

The README.md

I/O Collections

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version, (*1)

API

The entry point for accessing I/O collections are the io.collections.IOCollection implementations:, (*2)

  • io.collections.FileCollection - files in a given filesystem path
  • io.collections.ArchiveCollection - files inside a XAR archive

To access the files from more than one collection, use the io.collections.CollectionComposite class., (*3)

Iteration

The subpackage io.collections.iterate allows iterating I/O collections., (*4)

  • io.collections.iterate.IOCollectionIterator - iterate a given I/O collection, optionally recursive
  • io.collections.iterate.FilteredIOCollectionIterator - as above, but with an optional filter

Filters

The following filters are available:, (*5)

Date-based:, (*6)

  • io.collections.iterate.AccessedAfterFilter(util.Date $date)
  • io.collections.iterate.AccessedBeforeFilter(util.Date $date)
  • io.collections.iterate.CreatedAfterFilter(util.Date $date)
  • io.collections.iterate.CreatedBeforeFilter(util.Date $date)
  • io.collections.iterate.ModifiedAfterFilter(util.Date $date)
  • io.collections.iterate.ModifiedBeforeFilter(util.Date $date)

Size-based:, (*7)

  • io.collections.iterate.SizeEqualsFilter(int $compare)
  • io.collections.iterate.SizeBiggerThanFilter(int $limit)
  • io.collections.iterate.SizeSmallerThanFilter(int $limit)

Name-based:, (*8)

  • io.collections.iterate.ExtensionEqualsFilter(string $compare)
  • io.collections.iterate.NameEqualsFilter(string $compare)
  • io.collections.iterate.NameMatchesFilter(string $pattern)
  • io.collections.iterate.UriMatchesFilter(string $pattern)

Type-based:, (*9)

  • io.collections.iterate.CollectionFilter()

To combine filters, use the util.Filters class., (*10)

Example

This finds all JPEG files inside the directory /home/thekid/multimedia:, (*11)

use io\collections\FileCollection;
use io\collections\iterate\{FilteredIOCollectionIterator, ExtensionEqualsFiler};
use util\cmd\Console;
use util\Filters;

$iterator= new FilteredIOCollectionIterator(
  new FileCollection('/home/thekid/multimedia'),
  Filters::allOf([new ExtensionEqualsFilter('.jpg'), new ExtensionEqualsFilter('.JPG')]), 
  true
);

foreach ($iterator as $file) {
  Console::writeLine($file);
}

See also

The Versions

28/05 2017

dev-master

9999999-dev http://xp-framework.net/

I/O Collections for the XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

28/05 2017

v8.0.0

8.0.0.0 http://xp-framework.net/

I/O Collections for the XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

28/08 2016

v7.1.0

7.1.0.0 http://xp-framework.net/

I/O Collections for the XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

21/02 2016

v7.0.0

7.0.0.0 http://xp-framework.net/

I/O Collections for the XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module xp

27/09 2015

v6.5.0

6.5.0.0 http://xp-framework.net/

I/O Collections for the XP Framework

  Sources   Download

BSD-3-Clause

The Requires

 

module xp