Skip to content

Commit

Permalink
Fix parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Mar 28, 2017
1 parent 1066605 commit 7a9046a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions services/reports/ReportsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ private function parseReportResponse($body)
{
$bodyRows = explode(PHP_EOL, $body);
$firstRow = trim(array_shift($bodyRows), '"');
preg_match('/(.*)\s\(([0-9\-]+) - ([0-9\-]+)\)/', $firstRow, $matches);
$secondRow = array_shift($bodyRows);
preg_match('/(.*)\s\(([0-9\-]+) - ([0-9\-]+)\)/', $firstRow, $matches);
$reportName = 'n/a';
$dateStart = 'n/a';
$dateEnd = 'n/a';
if ($matches) {
list($reportName, $dateStart, $dateEnd) = $matches;
}
$names = explode("\t", trim($secondRow, '"'));
$report = new Report($matches[1], $matches[2], $matches[3], $names);
$report = new Report($reportName, $dateStart, $dateEnd, $names);
$mapper = $this->service->getMapper();
foreach ($bodyRows as $rowLine) {

Expand Down

0 comments on commit 7a9046a

Please sign in to comment.