| Total Complexity | 14 |
| Total Lines | 94 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Builder |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Command prefix. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | public $prefix; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Command options. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | public $options; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Command arguments. |
||
| 28 | * |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | public $arguments; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Returns $command as string. |
||
| 35 | * |
||
| 36 | * @return string $command command line string |
||
| 37 | */ |
||
| 38 | public function __toString() |
||
| 39 | { |
||
| 40 | $command = str_pad($this->prefix, strlen($this->prefix) + 1, ' ', STR_PAD_RIGHT); |
||
| 41 | $command .= !empty($this->options) ? str_pad($this->options, strlen($this->options) + 1, ' ', STR_PAD_RIGHT) : ''; |
||
| 42 | $command .= !empty($this->arguments) ? str_pad($this->arguments, strlen($this->arguments) + 1, ' ', STR_PAD_RIGHT) : ''; |
||
| 43 | return $command; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Set command line prefix. |
||
| 48 | * |
||
| 49 | * @param string $prefix command line prefix |
||
| 50 | * @return object class object |
||
| 51 | */ |
||
| 52 | final public function setPrefix($prefix) |
||
| 53 | { |
||
| 54 | $this->prefix = $prefix; |
||
| 55 | return $this; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Set command line options |
||
| 60 | * |
||
| 61 | * @param array $opts command line options |
||
| 62 | * @return object class object |
||
| 63 | */ |
||
| 64 | final public function setOptions(array $opts) |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Set command line arguments |
||
| 84 | * |
||
| 85 | * @param array $args command line arguments |
||
| 86 | * @return object class object |
||
| 87 | */ |
||
| 88 | final public function setArguments(array $args) |
||
| 105 |