class LoggingCommitter

Same name in this branch
  1. 11.x core/modules/package_manager/src/LoggingCommitter.php \Drupal\package_manager\LoggingCommitter

A composer-stager Committer decorator that adds logging.

@internal

Hierarchy

Expanded class hierarchy of LoggingCommitter

1 file declares its use of LoggingCommitter
StageBaseTest.php in core/modules/package_manager/tests/src/Kernel/StageBaseTest.php

File

core/modules/package_manager/tests/modules/package_manager_bypass/src/LoggingCommitter.php, line 19

Namespace

Drupal\package_manager_bypass
View source
final class LoggingCommitter implements CommitterInterface {
    use ComposerStagerExceptionTrait;
    use LoggingDecoratorTrait;
    
    /**
     * The decorated service.
     *
     * @var \PhpTuf\ComposerStager\API\Core\CommitterInterface
     */
    private $inner;
    
    /**
     * Constructs a Committer object.
     *
     * @param \Drupal\Core\State\StateInterface $state
     *   The state service.
     * @param \PhpTuf\ComposerStager\API\Core\CommitterInterface $inner
     *   The decorated committer service.
     */
    public function __construct(StateInterface $state, CommitterInterface $inner) {
        $this->state = $state;
        $this->inner = $inner;
    }
    
    /**
     * {@inheritdoc}
     */
    public function commit(PathInterface $stagingDir, PathInterface $activeDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, ?int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
        $this->saveInvocationArguments($stagingDir, $activeDir, $exclusions?->getAll(), $timeout);
        $this->throwExceptionIfSet();
        $this->inner
            ->commit($stagingDir, $activeDir, $exclusions, $callback, $timeout);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ComposerStagerExceptionTrait::setException public static function Sets an exception to be thrown.
ComposerStagerExceptionTrait::throwExceptionIfSet private function Throws the exception if set.
LoggingCommitter::$inner private property The decorated service.
LoggingCommitter::commit public function
LoggingCommitter::__construct public function Constructs a Committer object.
LoggingDecoratorTrait::$state private property The state service.
LoggingDecoratorTrait::getInvocationArguments public function Returns the arguments from every invocation of the main class method.
LoggingDecoratorTrait::saveInvocationArguments private function Records the arguments from an invocation of the main class method.

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