Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
CompositeProcessEnvironmentConfigurator
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 configure
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\Process;
21
22use Symfony\Component\Console\Output\OutputInterface;
23use Symfony\Component\Process\Process;
24
25/**
26 * Applies multiple process environment configurators in a stable order.
27 */
28  class CompositeProcessEnvironmentConfigurator implements ProcessEnvironmentConfiguratorInterface
29{
30    /**
31     * @param iterable<ProcessEnvironmentConfiguratorInterface> $configurators ordered environment configurators
32     */
33    public function __construct(
34        private iterable $configurators
35    ) {}
36
37    /**
38     * Configures environment variables for a queued process.
39     *
40     * @param Process $process the queued process that will be started
41     * @param OutputInterface $output the parent output used to infer console capabilities
42     */
43    public function configure(Process $process, OutputInterface $output): void
44    {
45        foreach ($this->configurators as $configurator) {
46            $configurator->configure($process, $output);
47        }
48    }
49}