ShellShortOption::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
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 6
rs 10
cc 3
nc 2
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPSu\ShellCommandBuilder\Literal;
6
7
use PHPSu\ShellCommandBuilder\Exception\ShellBuilderException;
8
use PHPSu\ShellCommandBuilder\ShellInterface;
9
10
/**
11
 * @internal
12
 * @psalm-internal PHPSu\ShellCommandBuilder
13
 */
14
final class ShellShortOption extends ShellWord
15
{
16
    protected $isShortOption = true;
17
    protected $prefix = ShellWord::SHORT_OPTION_CONTROL;
18
19
    /**
20
     * ShellArgument constructor.
21
     * @param string $option
22
     * @param ShellInterface|string $value
23
     * @throws ShellBuilderException
24
     */
25
    public function __construct(string $option, $value)
26
    {
27
        if (is_string($value) && empty($value)) {
28
            $this->delimiter = '';
29
        }
30
        parent::__construct($option, $value);
31
    }
32
}
33