Skip to content

Commit

Permalink
fix: append extension report
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Dec 27, 2020
1 parent 1117db2 commit fc2630f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,6 @@ private function arguments($args = null)
}
}

// Report format
if (isset(self::$argv['report-format']) && !empty(self::$argv['report-format'])) {
self::setReportFormat(self::$argv['report-format']);
}

// Offset
self::setOffset(0);
if (isset(self::$argv['offset']) && is_numeric(self::$argv['offset'])) {
Expand Down Expand Up @@ -479,6 +474,19 @@ private function arguments($args = null)
self::setPathReport(self::$argv['path-report']);
}

// Report format
if (isset(self::$argv['report-format']) && !empty(self::$argv['report-format'])) {
self::setReportFormat(self::$argv['report-format']);
}

if (in_array(self::$reportFormat, ['html', 'htm'])) {
if (!preg_match('/[\S][.](html|htm)$/', self::$pathReport)) {
self::$pathReport .= '.html';
}
} elseif (!preg_match('/[\S][.](logs|log|txt)$/', self::$pathReport)) {
self::$pathReport .= '.log';
}

// Path logs
if (isset(self::$argv['path-logs']) && !empty(self::$argv['path-logs'])) {
self::setPathLogs(self::$argv['path-logs']);
Expand Down Expand Up @@ -1890,14 +1898,6 @@ public static function setReportFormat($reportFormat)
self::$reportFormat = $reportFormat;
}

if (in_array(self::$reportFormat, ['html', 'htm'])) {
if (!preg_match('/[\S][.](html|htm)$/', self::$pathReport)) {
self::$pathReport .= '.html';
}
} elseif (!preg_match('/[\S][.](logs|log|txt)$/', self::$pathReport)) {
self::$pathReport .= '.log';
}

return new static();
}

Expand Down

0 comments on commit fc2630f

Please sign in to comment.