public function __construct($base) { $git = $this->_getGitWrapper()->workingCopy(getcwd()); try { $git->run(array('rev-list -1 ' . $base)); } catch (GitException $e) { throw new \InvalidArgumentException('Could not resolve ref ' . $base); } $baseHash = trim($git->getOutput()); parent::__construct($baseHash); if (!is_dir($this->getTempPath())) { mkdir($this->getTempPath(), 0777, true); } $this->_fileWrapper = new Directory($this->getTempPath()); }
/** * Parse files within a wrapper. * * @param AbstractWrapper $wrapper * @param string $prefix * * @return mixed */ protected function parseFiles($wrapper, $prefix) { $this->verbose($prefix . 'Fetching files ...'); $time = microtime(true); $fileAmount = count($wrapper->getAllFileNames()); $this->verbose(sprintf("\r" . $prefix . "Collected %d files in %0.2f seconds.", $fileAmount, microtime(true) - $time)); $this->verbose($prefix . 'Parsing ' . $fileAmount . ' files '); $this->debug(' in ' . $wrapper->getBasePath()); $time = microtime(true); $progress = new ProgressBar($this->getOutput(), $fileAmount); $progress->setFormat('%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s% RAM'); $dataTree = []; foreach ($wrapper->getDataTree() as $tree) { $dataTree = $wrapper->mergeTrees($dataTree, $tree); $progress->advance(); } $progress->clear(); $this->verbose(sprintf($prefix . "Parsed %d files in %0.2f seconds.", $fileAmount, microtime(true) - $time)); return $dataTree; }