class FindNewerDriver extends AbstractDriver

Properties

protected Channel|null $stopSignal from  AbstractDriver
protected bool $stopping from  AbstractDriver
protected list<string> $referenceFiles
protected bool $scanning
protected int $count

Methods

__construct(Option $option, StdoutLoggerInterface $logger)

No description

bool
isDarwin()

Determine if the current OS is macOS.

void
stop()

Stop watching and remove this driver's reference files.

void
watchAtInterval(float $seconds, callable $scan)

Run a polling scan until the driver is stopped.

array
resolveTargets(array $watchPaths)

Resolve configured watch paths to absolute targets.

array
existingTargets(array $targets)

Filter targets that currently exist.

array
exec(string $command)

Execute a shell command using Swoole's coroutine-aware exec.

string
shellArguments(array $arguments)

Escape a list of arguments for interpolation into a shell command.

void
watch(Channel $channel)

Watch for file changes using find -newer.

array
find(array $targets)

Find files newer than the reference file in the given targets.

array
scan()

Scan watched directories and files for changes.

string
getToModifyFile()

Get the path to the reference file to be modified.

string
getToScanFile()

Get the path to the reference file used for scanning.

void
ensureReferenceFiles()

Ensure this driver owns two reference files for change comparisons.

string
createReferenceFile()

Create a unique reference file owned by this driver.

void
updateReferenceFile(string $path)

Create or update a reference file used by find -newer.

void
removeReferenceFiles()

Remove every reference file currently owned by this driver.

Details

at line 23
__construct(Option $option, StdoutLoggerInterface $logger)

No description

Parameters

Option $option
StdoutLoggerInterface $logger

in AbstractDriver at line 26
bool isDarwin()

Determine if the current OS is macOS.

Return Value

bool

at line 98
void stop()

Stop watching and remove this driver's reference files.

Return Value

void

in AbstractDriver at line 47
protected void watchAtInterval(float $seconds, callable $scan)

Run a polling scan until the driver is stopped.

Parameters

float $seconds
callable $scan

Return Value

void

in AbstractDriver at line 80
protected array resolveTargets(array $watchPaths)

Resolve configured watch paths to absolute targets.

Parameters

array $watchPaths

Return Value

array

in AbstractDriver at line 100
protected array existingTargets(array $targets)

Filter targets that currently exist.

Parameters

array $targets

Return Value

array

in AbstractDriver at line 112
protected array exec(string $command)

Execute a shell command using Swoole's coroutine-aware exec.

Every interpolated argument must be escaped before it reaches this boundary.

Parameters

string $command

Return Value

array

in AbstractDriver at line 128
protected string shellArguments(array $arguments)

Escape a list of arguments for interpolation into a shell command.

Parameters

array $arguments

Return Value

string

at line 39
void watch(Channel $channel)

Watch for file changes using find -newer.

Parameters

Channel $channel

Return Value

void

at line 112
protected array find(array $targets)

Find files newer than the reference file in the given targets.

Parameters

array $targets

Return Value

array

at line 146
protected array scan()

Scan watched directories and files for changes.

The coroutine-aware find command may yield while stop state changes.

Return Value

array

at line 193
protected string getToModifyFile()

Get the path to the reference file to be modified.

Return Value

string

at line 201
protected string getToScanFile()

Get the path to the reference file used for scanning.

Return Value

string

at line 209
protected void ensureReferenceFiles()

Ensure this driver owns two reference files for change comparisons.

Return Value

void

at line 225
protected string createReferenceFile()

Create a unique reference file owned by this driver.

Return Value

string

at line 239
protected void updateReferenceFile(string $path)

Create or update a reference file used by find -newer.

Parameters

string $path

Return Value

void

at line 249
protected void removeReferenceFiles()

Remove every reference file currently owned by this driver.

Return Value

void