| Conditions | 7 |
| Paths | 1 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 11.3004 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 12 | public function __invoke(): bool |
|
| 31 | { |
||
| 32 | return $this->artisanCommand->task($this->title(), function () { |
||
| 33 | 12 | $Process = new Process(empty($this->arguments) |
|
|
|
|||
| 34 | 6 | ? $this->command |
|
| 35 | 12 | : array_merge([$this->command], $this->arguments)); |
|
| 36 | 12 | $Process->setTimeout(null); |
|
| 37 | |||
| 38 | 12 | $isVerbose = $this->artisanCommand->getOutput()->isVerbose(); |
|
| 39 | |||
| 40 | 12 | if ($isVerbose) { |
|
| 41 | $this->artisanCommand->getOutput()->newLine(); |
||
| 42 | if (Process::isTtySupported()) { |
||
| 43 | $Process->setTty(true); |
||
| 44 | } elseif (Process::isPtySupported()) { |
||
| 45 | $Process->setPty(true); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | $Process->run($isVerbose ? function ($type, $buffer) { |
||
| 50 | if (Process::ERR === $type) { |
||
| 51 | $this->artisanCommand->error($buffer); |
||
| 52 | } else { |
||
| 53 | $this->artisanCommand->line($buffer); |
||
| 54 | } |
||
| 55 | 12 | } : null); |
|
| 56 | |||
| 57 | 12 | return ! $Process->getExitCode(); |
|
| 58 | 12 | }); |
|
| 59 | } |
||
| 60 | } |
||
| 61 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.