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.
Mostrar archivo
Open project: puli/repository
Public Methods
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. |
Returns whether the current element should be accepted.
getCurrentResource()
public method