class ScaffoldFileInfo (View source)

internal  
 

Data object that keeps track of one scaffold file.

Scaffold files are identified primarily by their destination path. Each scaffold file also has an 'operation' object that controls how the scaffold file will be placed (e.g. via copy or symlink, or maybe by appending multiple files together). The operation may have one or more source files.

Properties

protected ScaffoldFilePath $destination

The path to the destination.

protected OperationInterface $op

The operation used to create the destination.

Methods

__construct(ScaffoldFilePath $destination, OperationInterface $op)

Constructs a ScaffoldFileInfo object.

op()

Gets the Scaffold operation.

string
packageName()

Gets the package name.

destination()

Gets the destination.

bool
overridden(string $providing_package)

Determines if this scaffold file has been overridden by another package.

string
interpolate(string $message, array $extra = [], mixed $default = FALSE)

Replaces placeholders in a message.

process(IOInterface $io, ScaffoldOptions $options)

Moves a single scaffold file from source to destination.

bool
hasChanged()

Returns TRUE if the target does not exist or has changed.

Details

__construct(ScaffoldFilePath $destination, OperationInterface $op)

Constructs a ScaffoldFileInfo object.

Parameters

ScaffoldFilePath $destination

The full and relative paths to the destination file and the package defining it.

OperationInterface $op

Operations object that will handle scaffolding operations.

OperationInterface op()

Gets the Scaffold operation.

Return Value

OperationInterface

Operations object that handles scaffolding (copy, make symlink, etc).

string packageName()

Gets the package name.

Return Value

string

The name of the package this scaffold file info was collected from.

ScaffoldFilePath destination()

Gets the destination.

Return Value

ScaffoldFilePath

The scaffold path to the destination file.

bool overridden(string $providing_package)

Determines if this scaffold file has been overridden by another package.

Parameters

string $providing_package

The name of the package that provides the scaffold file at this location, as returned by self::findProvidingPackage()

Return Value

bool

Whether this scaffold file if overridden or removed.

string interpolate(string $message, array $extra = [], mixed $default = FALSE)

Replaces placeholders in a message.

Parameters

string $message

Message with placeholders to fill in.

array $extra

Additional data to merge with the interpolator.

mixed $default

Default value to use for missing placeholders, or FALSE to keep them.

Return Value

string

Interpolated string with placeholders replaced.

ScaffoldResult process(IOInterface $io, ScaffoldOptions $options)

Moves a single scaffold file from source to destination.

Parameters

IOInterface $io

The scaffold file to be processed.

ScaffoldOptions $options

Assorted operational options, e.g. whether the destination should be a symlink.

Return Value

ScaffoldResult

The scaffold result.

final bool hasChanged()

Returns TRUE if the target does not exist or has changed.

Return Value

bool