class LoggingStager

Logs Composer Stager's Stager process output to a file.

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.

Hierarchy

Expanded class hierarchy of LoggingStager

2 files declare their use of LoggingStager
LoggingStagerTest.php in core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php
ServicesTest.php in core/modules/package_manager/tests/src/Kernel/ServicesTest.php

File

core/modules/package_manager/src/LoggingStager.php, line 22

Namespace

Drupal\package_manager
View source
final class LoggingStager implements StagerInterface {
    public function __construct(StagerInterface $decorated, ConfigFactoryInterface $configFactory) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function stage(array $composerCommand, PathInterface $activeDir, PathInterface $stagingDir, ?OutputCallbackInterface $callback = NULL, int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
        $path = $this->configFactory
            ->get('package_manager.settings')
            ->get('log');
        if ($path) {
            $callback = new FileProcessOutputCallback($path, $callback);
            $callback(OutputTypeEnum::OUT, sprintf("### Staging '%s' in %s\n", implode(' ', $composerCommand), $stagingDir->absolute()));
        }
        $this->decorated
            ->stage($composerCommand, $activeDir, $stagingDir, $callback, $timeout);
    }

}

Members

Title Sort descending Modifiers Object type Summary
LoggingStager::stage public function
LoggingStager::__construct public function

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