Skip to content

Commit

Permalink
Merge pull request #423 from phpmetrics/improved_code
Browse files Browse the repository at this point in the history
Remove not useful constant
  • Loading branch information
Halleck45 committed Mar 31, 2020
2 parents 9d78dc7 + 1d16eb4 commit 42c3a84
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
1 change: 0 additions & 1 deletion artifacts/phar/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
require_once 'phar://phpmetrics.phar/vendor/autoload.php';
define('PROJECT_DIR', dirname(__DIR__));
(new \Hal\Application\Application())->run(\$argv);
__HALT_COMPILER();
Expand Down
1 change: 0 additions & 1 deletion bin/phpmetrics
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ if (
// PLEASE do not edit this file without editing artifacts/phar/build.php
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

define('PROJECT_DIR', dirname(__DIR__));

(new \Hal\Application\Application())->run($argv);
40 changes: 23 additions & 17 deletions src/Hal/Report/Html/Reporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class Reporter
*/
private $output;

/**
* @var string
*/
protected $templateDir;

/**
* @param Config $config
* @param Output $output
Expand All @@ -26,6 +31,7 @@ public function __construct(Config $config, Output $output)
{
$this->config = $config;
$this->output = $output;
$this->templateDir = __DIR__ . '/../../../../templates';
}


Expand Down Expand Up @@ -65,27 +71,27 @@ public function generate(Metrics $metrics)
if (!file_exists($logDir . '/fonts')) {
mkdir($logDir . '/fonts', 0755, true);
}
recurse_copy(PROJECT_DIR . '/templates/html_report/js', $logDir . '/js');
recurse_copy(PROJECT_DIR . '/templates/html_report/css', $logDir . '/css');
recurse_copy(PROJECT_DIR . '/templates/html_report/images', $logDir . '/images');
recurse_copy(PROJECT_DIR . '/templates/html_report/fonts', $logDir . '/fonts');
recurse_copy($this->templateDir . '/html_report/js', $logDir . '/js');
recurse_copy($this->templateDir . '/html_report/css', $logDir . '/css');
recurse_copy($this->templateDir . '/html_report/images', $logDir . '/images');
recurse_copy($this->templateDir . '/html_report/fonts', $logDir . '/fonts');

// render dynamic pages
$this->renderPage(PROJECT_DIR . '/templates/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
$this->renderPage(PROJECT_DIR . '/templates/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
if ($this->config->has('git')) {
$this->renderPage(PROJECT_DIR . '/templates/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
}
$this->renderPage(PROJECT_DIR . '/templates/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);
$this->renderPage($this->templateDir . '/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);

// js data
file_put_contents(
Expand Down

0 comments on commit 42c3a84

Please sign in to comment.