Skip to content

Commit 04cda86

Browse files
committed
Get single task report output
1 parent 8addb0f commit 04cda86

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Dplr/Dplr.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,22 @@ public function getReports(): array
324324
return $this->reports;
325325
}
326326

327+
public function getSingleReportOutput(): ?string
328+
{
329+
if (!count($this->reports)) {
330+
throw new \OutOfRangeException('Not found task reports.');
331+
}
332+
333+
if (count($this->reports) > 1) {
334+
throw new \OutOfRangeException('There are more than one task report.');
335+
}
336+
337+
/** @var TaskReport $report */
338+
$report = $this->reports[0];
339+
340+
return $report->getOutput();
341+
}
342+
327343
protected function runTasks(callable $callback = null): void
328344
{
329345
$max = 0;

0 commit comments

Comments
 (0)