phplinter\Report\Html::create PHP Method

create() public method

----------------------------------------------------------------------+
public create ( $report, $penaltys = null, $root = null )
    public function create($report, $penaltys = null, $root = null)
    {
        $this->root = realpath($root);
        $output_dir = realpath($this->html['out']);
        if (!$output_dir) {
            $output_dir = $this->html['out'];
        }
        if ($this->config->check(OPT_VERBOSE)) {
            echo "Generating HTML Report to '{$output_dir}'\n";
        }
        if (file_exists($output_dir) && $this->html['overwrite']) {
            if ($this->config->check(OPT_VERBOSE)) {
                echo "Emptying `{$output_dir}`\n";
            }
            if (!$this->dry_run) {
                \phplinter\Path::del_recursive($output_dir);
            }
        }
        if (!file_exists($output_dir)) {
            $this->mkdir($output_dir, 0775);
        }
        $this->write($output_dir . '/html_report.css', $this->css());
        foreach ($report as $file => $rep) {
            $out = '<div class="wrapper"><table border="1" cellpadding="0" cellspacing="0">';
            $content = '';
            foreach ($rep as $_) {
                $content .= $this->_fmessage($_);
            }
            $out .= '<tr>';
            $score = SCORE_FULL + $penaltys[$file];
            $class = $this->get_score_class($score);
            $out .= '<td colspan="2" align="center" class="' . $class . '">';
            $out .= sprintf('Score: %.2f', $score);
            $out .= '</td>';
            $parts = explode('/', $file);
            $rfile = array_pop($parts);
            $depth = count($parts);
            $path = $depth > 1 ? implode('/', $parts) : '';
            $path = substr(realpath($path), strlen($this->root));
            $out .= '<td class="filename">';
            $out .= "{$path}/{$rfile}";
            $out .= '<td class="line">';
            $out .= 'Line</td></tr>';
            $out .= '</td></tr>';
            $out .= $content;
            $out .= '</table></div>';
            $dir = $output_dir . $path;
            if (!file_exists($dir)) {
                $this->mkdir($dir, 0775, true);
            }
            $pp = explode('/', substr(realpath(implode('/', $parts)), mb_strlen($this->root)));
            $ofile = $dir . '/' . strtr($rfile, './', '__') . '.html';
            $this->write($ofile, $this->_html($out, count($pp)));
            $url['phplinter___file'] = $file;
            $url['phplinter___url'] = strtr($rfile, './', '__') . '.html';
            $url['phplinter___sort'] = strtolower($url['phplinter___url']);
            $this->parts($pp, $url, $urls);
        }
        $urls = $this->sort($urls);
        $this->output_indexes($urls, $penaltys);
    }