GlobResource
in package
implements
IteratorAggregate, SelfCheckingResourceInterface
GlobResource represents a set of resources stored on the filesystem.
Only existence/removal is tracked (not mtimes.)
Tags
Table of Contents
Interfaces
- IteratorAggregate
- SelfCheckingResourceInterface
- Interface for Resources that can check for freshness autonomously, without special support from external services.
Properties
- $excludedPrefixes : array<string|int, mixed>
- $forExclusion : bool
- $globBrace : int
- $hash : string
- $pattern : string
- $prefix : string
- $recursive : bool
Methods
- __construct() : mixed
- __toString() : string
- Returns a string representation of the Resource.
- getIterator() : Traversable
- getPrefix() : string
- isFresh() : bool
- Returns true if the resource has not been updated since the given timestamp.
- computeHash() : string
- expandGlob() : array<string|int, mixed>
Properties
$excludedPrefixes
private
array<string|int, mixed>
$excludedPrefixes
$forExclusion
private
bool
$forExclusion
$globBrace
private
int
$globBrace
$hash
private
string
$hash
$pattern
private
string
$pattern
$prefix
private
string
$prefix
$recursive
private
bool
$recursive
Methods
__construct()
public
__construct(string $prefix, string $pattern, bool $recursive[, bool $forExclusion = false ][, array<string|int, mixed> $excludedPrefixes = [] ]) : mixed
Parameters
- $prefix : string
-
A directory prefix
- $pattern : string
-
A glob pattern
- $recursive : bool
-
Whether directories should be scanned recursively or not
- $forExclusion : bool = false
- $excludedPrefixes : array<string|int, mixed> = []
Tags
__toString()
Returns a string representation of the Resource.
public
__toString() : string
This method is necessary to allow for resource de-duplication, for example by means of array_unique(). The string returned need not have a particular meaning, but has to be identical for different ResourceInterface instances referring to the same resource; and it should be unlikely to collide with that of other, unrelated resource instances.
Return values
stringgetIterator()
public
getIterator() : Traversable
Return values
TraversablegetPrefix()
public
getPrefix() : string
Return values
stringisFresh()
Returns true if the resource has not been updated since the given timestamp.
public
isFresh(int $timestamp) : bool
Parameters
- $timestamp : int
-
The last time the resource was loaded
Return values
boolcomputeHash()
private
computeHash() : string
Return values
stringexpandGlob()
private
expandGlob(string $pattern) : array<string|int, mixed>
Parameters
- $pattern : string