AppendOp
class AppendOp extends AbstractOperation (View source)
| internal |
Scaffold operation to add to the beginning and/or end of a scaffold file.
Constants
| ID |
Identifies Append operations. |
Properties
| protected string | $contents | Cached contents of scaffold file to be written to disk. |
from AbstractOperation |
| protected ScaffoldFilePath | $prepend | Path to the source file to prepend, if any. |
|
| protected ScaffoldFilePath | $append | Path to the source file to append, if any. |
|
| protected ScaffoldFilePath | $default | Path to the default data to use when appending to an empty file. |
|
| protected | $managed | An indicator of whether the file we are appending to is managed or not. |
|
| protected | $forceAppend | An indicator of whether we are allowed to append to a non-scaffolded file. |
|
| protected string | $originalContents | The contents from the file that we are prepending / appending to. |
Methods
Returns the exact data that will be written to the scaffold files.
Load the scaffold contents or otherwise generate what is needed.
Determines what to do if operation is used at same path as a previous op.
Determines what to do if operation is used without a previous operation.
Constructs an AppendOp.
Process this scaffold operation.
Check to see if the append/prepend data has already been applied.
Details
final string
contents()
Returns the exact data that will be written to the scaffold files.
protected string
generateContents()
Load the scaffold contents or otherwise generate what is needed.
OperationInterface
scaffoldOverExistingTarget(OperationInterface $existing_target)
Determines what to do if operation is used at same path as a previous op.
Default behavior is to scaffold this operation at the specified destination, ignoring whatever was there before.
OperationInterface
scaffoldAtNewLocation(ScaffoldFilePath $destination)
Determines what to do if operation is used without a previous operation.
Default behavior is to scaffold this operation at the specified destination. Most operations overwrite rather than modify existing files, and therefore do not need to do anything special when there is no existing file.
__construct(ScaffoldFilePath $prepend_path = NULL, ScaffoldFilePath $append_path = NULL, bool $force_append = FALSE, ScaffoldFilePath $default_path = NULL)
Constructs an AppendOp.
ScaffoldResult
process(ScaffoldFilePath $destination, IOInterface $io, ScaffoldOptions $options)
Process this scaffold operation.
protected bool
existingFileHasData(string $contents, ScaffoldFilePath $data_path)
Check to see if the append/prepend data has already been applied.