Documentation

GlobResource
in package
implements IteratorAggregate, SelfCheckingResourceInterface

GlobResource represents a set of resources stored on the filesystem.

Only existence/removal is tracked (not mtimes.)

Tags
author

Nicolas Grekas p@tchwork.com

final
implements

\IteratorAggregate<string, \SplFileInfo>

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

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
throws
InvalidArgumentException

__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
string

getIterator()

public getIterator() : Traversable
Return values
Traversable

getPrefix()

public getPrefix() : string
Return values
string

isFresh()

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
bool

computeHash()

private computeHash() : string
Return values
string

expandGlob()

private expandGlob(string $pattern) : array<string|int, mixed>
Parameters
$pattern : string
Return values
array<string|int, mixed>

        
On this page

Search results