Skip to content

Commit 42c3a84

Browse files
authored
Merge pull request #423 from phpmetrics/improved_code
Remove not useful constant
2 parents 9d78dc7 + 1d16eb4 commit 42c3a84

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

artifacts/phar/build.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4848
4949
require_once 'phar://phpmetrics.phar/vendor/autoload.php';
50-
define('PROJECT_DIR', dirname(__DIR__));
5150
(new \Hal\Application\Application())->run(\$argv);
5251
5352
__HALT_COMPILER();

bin/phpmetrics

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ if (
2323
// PLEASE do not edit this file without editing artifacts/phar/build.php
2424
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2525

26-
define('PROJECT_DIR', dirname(__DIR__));
2726

2827
(new \Hal\Application\Application())->run($argv);

src/Hal/Report/Html/Reporter.php

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class Reporter
1818
*/
1919
private $output;
2020

21+
/**
22+
* @var string
23+
*/
24+
protected $templateDir;
25+
2126
/**
2227
* @param Config $config
2328
* @param Output $output
@@ -26,6 +31,7 @@ public function __construct(Config $config, Output $output)
2631
{
2732
$this->config = $config;
2833
$this->output = $output;
34+
$this->templateDir = __DIR__ . '/../../../../templates';
2935
}
3036

3137

@@ -65,27 +71,27 @@ public function generate(Metrics $metrics)
6571
if (!file_exists($logDir . '/fonts')) {
6672
mkdir($logDir . '/fonts', 0755, true);
6773
}
68-
recurse_copy(PROJECT_DIR . '/templates/html_report/js', $logDir . '/js');
69-
recurse_copy(PROJECT_DIR . '/templates/html_report/css', $logDir . '/css');
70-
recurse_copy(PROJECT_DIR . '/templates/html_report/images', $logDir . '/images');
71-
recurse_copy(PROJECT_DIR . '/templates/html_report/fonts', $logDir . '/fonts');
74+
recurse_copy($this->templateDir . '/html_report/js', $logDir . '/js');
75+
recurse_copy($this->templateDir . '/html_report/css', $logDir . '/css');
76+
recurse_copy($this->templateDir . '/html_report/images', $logDir . '/images');
77+
recurse_copy($this->templateDir . '/html_report/fonts', $logDir . '/fonts');
7278

7379
// render dynamic pages
74-
$this->renderPage(PROJECT_DIR . '/templates/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
75-
$this->renderPage(PROJECT_DIR . '/templates/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
76-
$this->renderPage(PROJECT_DIR . '/templates/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
77-
$this->renderPage(PROJECT_DIR . '/templates/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
78-
$this->renderPage(PROJECT_DIR . '/templates/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
79-
$this->renderPage(PROJECT_DIR . '/templates/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
80-
$this->renderPage(PROJECT_DIR . '/templates/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
81-
$this->renderPage(PROJECT_DIR . '/templates/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
82-
$this->renderPage(PROJECT_DIR . '/templates/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
83-
$this->renderPage(PROJECT_DIR . '/templates/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
84-
$this->renderPage(PROJECT_DIR . '/templates/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
80+
$this->renderPage($this->templateDir . '/html_report/index.php', $logDir . '/index.html', $consolidated, $history);
81+
$this->renderPage($this->templateDir . '/html_report/loc.php', $logDir . '/loc.html', $consolidated, $history);
82+
$this->renderPage($this->templateDir . '/html_report/relations.php', $logDir . '/relations.html', $consolidated, $history);
83+
$this->renderPage($this->templateDir . '/html_report/coupling.php', $logDir . '/coupling.html', $consolidated, $history);
84+
$this->renderPage($this->templateDir . '/html_report/all.php', $logDir . '/all.html', $consolidated, $history);
85+
$this->renderPage($this->templateDir . '/html_report/oop.php', $logDir . '/oop.html', $consolidated, $history);
86+
$this->renderPage($this->templateDir . '/html_report/complexity.php', $logDir . '/complexity.html', $consolidated, $history);
87+
$this->renderPage($this->templateDir . '/html_report/panel.php', $logDir . '/panel.html', $consolidated, $history);
88+
$this->renderPage($this->templateDir . '/html_report/violations.php', $logDir . '/violations.html', $consolidated, $history);
89+
$this->renderPage($this->templateDir . '/html_report/packages.php', $logDir . '/packages.html', $consolidated, $history);
90+
$this->renderPage($this->templateDir . '/html_report/package_relations.php', $logDir . '/package_relations.html', $consolidated, $history);
8591
if ($this->config->has('git')) {
86-
$this->renderPage(PROJECT_DIR . '/templates/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
92+
$this->renderPage($this->templateDir . '/html_report/git.php', $logDir . '/git.html', $consolidated, $history);
8793
}
88-
$this->renderPage(PROJECT_DIR . '/templates/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);
94+
$this->renderPage($this->templateDir . '/html_report/junit.php', $logDir . '/junit.html', $consolidated, $history);
8995

9096
// js data
9197
file_put_contents(

0 commit comments

Comments
 (0)