Pipeline::pipeErrorForward()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPSu\ShellCommandBuilder\Collection;
6
7
use PHPSu\ShellCommandBuilder\Definition\ControlOperator;
8
use PHPSu\ShellCommandBuilder\Exception\ShellBuilderException;
9
use PHPSu\ShellCommandBuilder\ShellCommand;
10
use PHPSu\ShellCommandBuilder\ShellInterface;
11
12
/**
13
 * @internal
14
 * @psalm-internal PHPSu\ShellCommandBuilder
15
 */
16
final class Pipeline extends AbstractCollection
17
{
18
    /**
19
     * @param string|ShellInterface $command
20
     * @return $this
21
     * @throws ShellBuilderException
22
     */
23
    public static function pipe($command): self
24
    {
25
        $pipeline = new self();
26
        $pipeline->tuple = $pipeline->toTuple($command, ControlOperator::PIPELINE);
27
        return $pipeline;
28
    }
29
30
    /**
31
     * @param string|ShellInterface $command
32
     * @return $this
33
     * @throws ShellBuilderException
34
     */
35
    public static function pipeErrorForward($command): self
36
    {
37
        $pipeline = new self();
38
        $pipeline->tuple = $pipeline->toTuple($command, ControlOperator::PIPELINE_WITH_STDERR_FORWARD);
39
        return $pipeline;
40
    }
41
}
42