PHP Class Puli\Repository\Resource\Iterator\ResourceFilterIterator

You can use the iterator to filter files with a specific extension: php $iterator = new ResourceFilterIterator( new RecursiveResourceIteratorIterator( new ResourceCollectionIterator($collection), ), '.css', ResourceFilterIterator::MATCH_SUFFIX ); foreach ($iterator as $path => $resource) { ... } See {@link __construct} for more information on the filter options.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: extends FilterIterato\FilterIterator, implements Puli\Repository\Api\ResourceIterator
Mostrar archivo Open project: puli/repository

Public Methods

Method Description
__construct ( Puli\Repository\Api\ResourceIterator $iterator, string $pattern, integer | null $mode = null ) Creates a new iterator.
accept ( ) : boolean | integer Returns whether the current element should be accepted.
getCurrentResource ( )

Method Details

__construct() public method

The following constants can be used to configure what to filter by: * {@link FILTER_BY_PATH}: The pattern is matched against the paths; * {@link FILTER_BY_NAME}: The pattern is matched against the names. The following constants can be used to configure how to match the selected text: * {@link MATCH_PREFIX}: Tests whether the pattern is a prefix of the matched text; * {@link MATCH_SUFFIX}: Tests whether the pattern is a suffix of the matched text; * {@link MATCH_REGEX}: Treats the pattern as regular expression. By default, the mode FILTER_BY_PATH | MATCH_REGEX is used.
public __construct ( Puli\Repository\Api\ResourceIterator $iterator, string $pattern, integer | null $mode = null )
$iterator Puli\Repository\Api\ResourceIterator The filtered iterator.
$pattern string The pattern to match.
$mode integer | null A bitwise combination of the mode constants.

accept() public method

Returns whether the current element should be accepted.
public accept ( ) : boolean | integer
return boolean | integer Returns `false` if the current element should be filtered out.

getCurrentResource() public method

public getCurrentResource ( )