Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
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\Process\Process;
23
24/**
25 * Defines a fluent builder responsible for constructing process instances.
26 *
27 * Implementations MUST preserve the builder state consistently across chained
28 * calls and SHALL return a process configured according to all previously
29 * supplied arguments when build() is invoked.
30 */
31interface ProcessBuilderInterface
32{
33    /**
34     * Adds an argument to the process being built.
35     *
36     * Implementations MUST append or register the provided argument for later
37     * use when build() is called. When a non-empty value is provided, the
38     * implementation SHALL associate that value with the argument according to
39     * its command-building strategy.
40     *
41     * @param string $argument the argument name or token that SHALL be added to the process definition
42     * @param ?string $value an optional value associated with the argument
43     *
44     * @return self the current builder instance for fluent chaining
45     */
46    public function withArgument(string $argument, ?string $value = null): self;
47
48    /**
49     * Builds a process instance for the specified command.
50     *
51     * Implementations MUST return a Process configured with the provided
52     * command and all arguments previously collected by the builder. The
53     * returned process SHOULD be ready for execution by the caller.
54     *
55     * @param string|array $command the base command that SHALL be used to create the process
56     *
57     * @return Process the configured process instance
58     */
59    public function build(string|array $command): Process;
60}