interface OperationInterface

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Operations/OperationInterface.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
  2. 8.9.x composer/Plugin/Scaffold/Operations/OperationInterface.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
  3. 11.x composer/Plugin/Scaffold/Operations/OperationInterface.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface

Interface for scaffold operation objects.

@internal

Hierarchy

Expanded class hierarchy of OperationInterface

All classes that implement OperationInterface

1 file declares its use of OperationInterface
ScaffoldFileInfo.php in composer/Plugin/Scaffold/ScaffoldFileInfo.php

File

composer/Plugin/Scaffold/Operations/OperationInterface.php, line 14

Namespace

Drupal\Composer\Plugin\Scaffold\Operations
View source
interface OperationInterface {
    
    /**
     * Returns the exact data that will be written to the scaffold files.
     *
     * @return string
     *   Data to be written to the scaffold location.
     */
    public function contents();
    
    /**
     * Process this scaffold operation.
     *
     * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
     *   Scaffold file's destination path.
     * @param \Composer\IO\IOInterface $io
     *   IOInterface to write to.
     * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options
     *   Various options that may alter the behavior of the operation.
     *
     * @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
     *   Result of the scaffolding operation.
     */
    public function process(ScaffoldFilePath $destination, IOInterface $io, ScaffoldOptions $options);
    
    /**
     * 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.
     *
     * @param OperationInterface $existing_target
     *   Existing file at the destination path that we should combine with.
     *
     * @return OperationInterface
     *   The op to use at this destination.
     */
    public function scaffoldOverExistingTarget(OperationInterface $existing_target);
    
    /**
     * 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.
     *
     * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
     *   Scaffold file's destination path.
     *
     * @return OperationInterface
     *   The op to use at this destination.
     */
    public function scaffoldAtNewLocation(ScaffoldFilePath $destination);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
OperationInterface::contents public function Returns the exact data that will be written to the scaffold files. 1
OperationInterface::process public function Process this scaffold operation. 3
OperationInterface::scaffoldAtNewLocation public function Determines what to do if operation is used without a previous operation. 1
OperationInterface::scaffoldOverExistingTarget public function Determines what to do if operation is used at same path as a previous op. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.