class ChainFileSource extends AbstractSource implements SourceInterface

Properties

protected Processor $processor

The query post processor implementation.

from  AbstractSource
protected array $sources
protected array $pathCache
protected bool $allowCacheRefreshes
string $activeSourceKey

Methods

getProcessor()

Get the query post processor used by the connection.

int|string
makeCacheKey(string $name = '')

Generate a cache key unique to this source.

__construct(array $sources)

Create a new source instance.

void
populateCache(bool $refresh = false)

Populate the local cache of paths available in each source

getActiveSource()

Get the source for use with CRUD operations

getSourceForPath(string $path)

Get the appropriate source for the provided path

string
makeFilePath(string $dirName, string $fileName, string $extension)

Helper to make file path.

mixed
select(string $dirName, string $fileName, string $extension)

Returns a single source.

array
selectAll(string $dirName, array $options = [])

Returns all sources.

bool
insert(string $dirName, string $fileName, string $extension, string $content)

Creates a new source.

int
update(string $dirName, string $fileName, string $extension, string $content, string $oldFileName = null, string $oldExtension = null)

Updates an existing source.

int
delete(string $dirName, string $fileName, string $extension)

Run a delete statement against the source.

int
lastModified(string $dirName, string $fileName, string $extension)

Return the last modified date of an object

string
getPathsCacheKey()

Generate a paths cache key unique to this source

array
getAvailablePaths()

Get all available paths within this source

Details

in AbstractSource at line 18
Processor getProcessor()

Get the query post processor used by the connection.

Return Value

Processor

at line 267
int|string makeCacheKey(string $name = '')

Generate a cache key unique to this source.

Parameters

string $name

Return Value

int|string

at line 39
__construct(array $sources)

Create a new source instance.

Parameters

array $sources

at line 56
protected void populateCache(bool $refresh = false)

Populate the local cache of paths available in each source

Parameters

bool $refresh

Default false, set to true to force the cache to be rebuilt

Return Value

void

at line 80
protected SourceInterface getActiveSource()

Get the source for use with CRUD operations

Return Value

SourceInterface

at line 91
protected SourceInterface getSourceForPath(string $path)

Get the appropriate source for the provided path

Parameters

string $path

Return Value

SourceInterface

at line 116
protected string makeFilePath(string $dirName, string $fileName, string $extension)

Helper to make file path.

Parameters

string $dirName
string $fileName
string $extension

Return Value

string

at line 130
mixed select(string $dirName, string $fileName, string $extension)

Returns a single source.

Parameters

string $dirName
string $fileName
string $extension

Return Value

mixed

at line 152
array selectAll(string $dirName, array $options = [])

Returns all sources.

Parameters

string $dirName
array $options

Return Value

array

at line 176
bool insert(string $dirName, string $fileName, string $extension, string $content)

Creates a new source.

Parameters

string $dirName
string $fileName
string $extension
string $content

Return Value

bool

at line 198
int update(string $dirName, string $fileName, string $extension, string $content, string $oldFileName = null, string $oldExtension = null)

Updates an existing source.

Parameters

string $dirName
string $fileName
string $extension
string $content
string $oldFileName
string $oldExtension

Return Value

int

at line 235
int delete(string $dirName, string $fileName, string $extension)

Run a delete statement against the source.

Parameters

string $dirName
string $fileName
string $extension

Return Value

int

at line 253
int lastModified(string $dirName, string $fileName, string $extension)

Return the last modified date of an object

Parameters

string $dirName
string $fileName
string $extension

Return Value

int

at line 283
string getPathsCacheKey()

Generate a paths cache key unique to this source

Return Value

string

at line 293
array getAvailablePaths()

Get all available paths within this source

Return Value

array

$paths ['path/to/file1.md' => true (path can be handled and exists), 'path/to/file2.md' => false (path can be handled but doesn't exist)]