Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Jan 2, 2018
1 parent f6bbb1a commit caac1e3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/PoolStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __toString(): string

protected function lines(string ...$lines): string
{
return implode("\n", $lines);
return implode(PHP_EOL, $lines);
}

protected function summaryToString(): string
Expand All @@ -39,20 +39,14 @@ protected function summaryToString(): string

protected function failedToString(): string
{
$failed = $this->pool->getFailed();

$status = '';

foreach ($failed as $process) {
return (string) array_reduce($this->pool->getFailed(), function ($currentStatus, ParallelProcess $process) {
$output = $process->getErrorOutput();

if ($output instanceof SerializableException) {
$output = get_class($output->asThrowable()).': '.$output->asThrowable()->getMessage();
}

$status = $this->lines($status, "{$process->getPid()} failed with {$output}");
}

return $status;
return $this->lines((string) $currentStatus, "{$process->getPid()} failed with {$output}");
});
}
}

0 comments on commit caac1e3

Please sign in to comment.