public function __construct($projectPath, $reportFolder = null)
{
$this->startTime = time();
if (empty($projectPath)) {
throw new \Exception(__METHOD__ . ": Project path given was empty.");
}
$this->projectPath = $projectPath;
$reportFolder = main::getRealPath($reportFolder);
if ($reportFolder !== false) {
$this->reportFolder = $reportFolder;
} else {
$this->reportFolder = PHP7MAR_DIR . DIRECTORY_SEPARATOR . 'reports';
}
$this->fullFilePath = $this->reportFolder . DIRECTORY_SEPARATOR . date('Y-m-d H.i.s ') . basename($this->projectPath, '.php') . ".md";
$this->file = fopen($this->fullFilePath, 'w+');
register_shutdown_function([$this, 'onShutdown']);
$this->add(date('c', $this->startTime), 0, 1);
$this->add("Scanning {$this->projectPath}", 0, 1);
}