Exakat\Reports\Ambassador::generateSettings PHP Method

generateSettings() private method

private generateSettings ( )
    private function generateSettings()
    {
        $info = array(array('Code name', $this->config->project_name));
        if (!empty($this->config->project_description)) {
            $info[] = array('Code description', $this->config->project_description);
        }
        if (!empty($this->config->project_packagist)) {
            $info[] = array('Packagist', '<a href="https://packagist.org/packages/' . $this->config->project_packagist . '">' . $this->config->project_packagist . '</a>');
        }
        if (!empty($this->config->project_url)) {
            $info[] = array('Home page', '<a href="' . $this->config->project_url . '">' . $this->config->project_url . '</a>');
        }
        if (file_exists($this->config->projects_root . '/projects/' . $this->config->project . '/code/.git/config')) {
            $gitConfig = file_get_contents($this->config->projects_root . '/projects/' . $this->config->project . '/code/.git/config');
            preg_match('#url = (\\S+)\\s#is', $gitConfig, $r);
            $info[] = array('Git URL', $r[1]);
            $res = shell_exec('cd ' . $this->config->projects_root . '/projects/' . $this->config->project . '/code/; git branch');
            $info[] = array('Git branch', trim($res));
            $res = shell_exec('cd ' . $this->config->projects_root . '/projects/' . $this->config->project . '/code/; git rev-parse HEAD');
            $info[] = array('Git commit', trim($res));
        } else {
            $info[] = array('Repository URL', 'Downloaded archive');
        }
        $info[] = array('Number of PHP files', $this->datastore->getHash('files'));
        $info[] = array('Number of lines of code', $this->datastore->getHash('loc'));
        $info[] = array('Number of lines of code with comments', $this->datastore->getHash('locTotal'));
        $info[] = array('Report production date', date('r', strtotime('now')));
        $php = new Phpexec($this->config->phpversion);
        $info[] = array('PHP used', $php->getActualVersion() . ' (version ' . $this->config->phpversion . ' configured)');
        $info[] = array('Ignored files/folders', implode(', ', $this->config->ignore_dirs));
        $info[] = array('Exakat version', Exakat::VERSION . ' ( Build ' . Exakat::BUILD . ') ');
        $settings = '';
        foreach ($info as $i) {
            $settings .= "<tr><td>{$i['0']}</td><td>{$i['1']}</td></tr>";
        }
        $html = $this->getBasedPage('used_settings');
        $html = $this->injectBloc($html, 'SETTINGS', $settings);
        $this->putBasedPage('used_settings', $html);
    }