Completed
Push — master ( e1c388...7bf58d )
by
unknown
12:55 queued 10:58
created

ShellArgument::validate()   A

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 0
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
final class ShellArgument extends ShellWord
11
{
12
    protected $isArgument = true;
13
    protected $delimiter = '';
14
15
    /**
16
     * ShellArgument constructor.
17
     * @param ShellInterface|string $argument
18
     */
19
    public function __construct($argument)
20
    {
21
        parent::__construct('', $argument);
22
    }
23
24
    protected function validate(): void
25
    {
26
        if (is_string($this->value) && empty($this->value)) {
27
            throw new ShellBuilderException('Argument cant be empty');
28
        }
29
        parent::validate();
30
    }
31
}
32