<commit_before><?php
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));

$reporter = new Doctrine_Coverage_Report("coverage.txt");
?>
<html>
<head>
<style type="text/css">
    .covered{ background: green;}
    .normal{ background: white;}
    .red{ background: red;}
    .orange{ background: #f90;}

 dl.table-display
{
margin: 2em 0;
padding: 0;
font-family: georgia, times, serif;
}

.table-display dt
{
float: left;
margin: 0 0 0 0;
padding: 0 .5em 0 .5em;
}

/* commented backslash hack for mac-ie5 \*/
dt { clear: both; }
/* end hack */

.table-display dd{
    float: left;
    margin: 0 0 0 0;
    }
</style>
</head>
<body>
<?php

if(isset($_GET["file"])){
    echo '<h1>Coverage for ' . $_GET["file"] . '</h1>';
    echo '<a href="cc.php">Back to coverage report</a>';
    $reporter->showFile($_GET["file"]);
}else{
?>
    <h1>Coverage report for Doctrine</h1>
    <p>Default mode shows results sorted by percentage. This can be changed with GET variables:<br /> <ul><li>order = covered|total|maybe|notcovered|percentage</li><li>desc=true</li></ul></p>
    <table>
     <tr><th></th><th>Percentage</th><th>Total</th><th>Covered</th><th>Maybe</th><th>Not Covered</th><th></th></tr>
<?php
    $reporter->showSummary();
    echo "</table>";
}
?>
</body>
</html>

<?php

/*
 *
 * This class is a mess right now. Will clean it up later perhaps. If we do not 
 * change to simpletest..
 */
class Doctrine_Coverage_Report
{

    const COVERED = 1;
    const MAYBE = -2;
    const NOTCOVERED = -1;

    private $path;
    private $coverage;
    private $key;
    private $covered;
    private $totallines = 0;
    private $totalcovered = 0;
    private $totalmaybe = 0;
    private $totalnotcovered = 0;

    public function __construct($file)
    {
        $result = unserialize(file_get_contents("coverage.txt"));
        $this->path = $result["path"];
        $this->coverage = $result["coverage"];

        $this->sortBy ="percentage"; // default sort
    }

    public function showFile($fileName)
    {
        $key = $this->path . $fileName;
        $html = '<div id="coverage">';
        if( !isset( $this->coverage[$key]))
        {
            echo '<h2>This file has not been tested!</h2>';
        }
        $coveredLines = $this->coverage[$key];
        $fileArray = file(Doctrine::getPath() . "/".$fileName);
        $html .= '<dl class="table-display">' . "\n";
        foreach( $fileArray as $num => $line){
            $linenum = $num+1;
            $html .= '<dt>' . $linenum . '</dt>' . "\n";
            $class ="normal";
            if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == 1){
                $class = "covered";
            }else if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -1){
                $class ="red";
            }else if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -2){
                $class ="orange";
            }
            $html .= '<dd class="' . $class . '">' . htmlspecialchars($line) . '</dd>' . "\n";
        }
        $html .='</dl></div>';
        echo $html;
    }

    public function generateNotCoveredFiles()
    {
        $it = new RecursiveDirectoryIterator(Doctrine::getPath());

        $notCoveredArray = array();
        foreach( new RecursiveIteratorIterator($it) as $file){
            if( strpos($file->getPathname(), ".svn")){
                continue;
            }
            $path = Doctrine::getPath() . DIRECTORY_SEPERATOR;
            $coveredPath = str_replace($path, $this->path, $file->getPathname());
            if( isset($this->coverage[$coveredPath])){
                continue;
            }

            $class = str_replace(DIRECTORY_SEPARATOR, '_', substr($file, strlen($this->path), -4));
            if (strpos($class, '_Interface')) {
                continue;
            }

            if(!class_exists($class)){
                continue;
            }

            try{
                $refClass = new ReflectionClass($class);
            }catch(Exception $e){
                echo $e->getMessage();
                continue;<commit_msg>fixing cc report<commit_after><?php
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));

$reporter = new Doctrine_Coverage_Report("coverage.txt");
?>
<html>
<head>
<style type="text/css">
    .covered{ background: green;}
    .normal{ background: white;}
    .red{ background: red;}
    .orange{ background: #f90;}

 dl.table-display
{
margin: 2em 0;
padding: 0;
font-family: georgia, times, serif;
}

.table-display dt
{
float: left;
margin: 0 0 0 0;
padding: 0 .5em 0 .5em;
}

/* commented backslash hack for mac-ie5 \*/
dt { clear: both; }
/* end hack */

.table-display dd{
    float: left;
    margin: 0 0 0 0;
    }
</style>
</head>
<body>
<?php

if(isset($_GET["file"])){
    echo '<h1>Coverage for ' . $_GET["file"] . '</h1>';
    echo '<a href="cc.php">Back to coverage report</a>';
    $reporter->showFile($_GET["file"]);
}else{
?>
    <h1>Coverage report for Doctrine</h1>
    <p>Default mode shows results sorted by percentage. This can be changed with GET variables:<br /> <ul><li>order = covered|total|maybe|notcovered|percentage</li><li>desc=true</li></ul></p>
    <table>
     <tr><th></th><th>Percentage</th><th>Total</th><th>Covered</th><th>Maybe</th><th>Not Covered</th><th></th></tr>
<?php
    $reporter->showSummary();
    echo "</table>";
}
?>
</body>
</html>

<?php

/*
 *
 * This class is a mess right now. Will clean it up later perhaps. If we do not 
 * change to simpletest..
 */
class Doctrine_Coverage_Report
{

    const COVERED = 1;
    const MAYBE = -2;
    const NOTCOVERED = -1;

    private $path;
    private $coverage;
    private $key;
    private $covered;
    private $totallines = 0;
    private $totalcovered = 0;
    private $totalmaybe = 0;
    private $totalnotcovered = 0;

    public function __construct($file)
    {
        $result = unserialize(file_get_contents("coverage.txt"));
        $this->path = $result["path"];
        $this->coverage = $result["coverage"];

        $this->sortBy ="percentage"; // default sort
    }

    public function showFile($fileName)
    {
        $key = $this->path . $fileName;
        $html = '<div id="coverage">';
        if( !isset( $this->coverage[$key]))
        {
            echo '<h2>This file has not been tested!</h2>';
        }
        $coveredLines = $this->coverage[$key];
        $fileArray = file(Doctrine::getPath() . "/".$fileName);
        $html .= '<dl class="table-display">' . "\n";
        foreach( $fileArray as $num => $line){
            $linenum = $num+1;
            $html .= '<dt>' . $linenum . '</dt>' . "\n";
            $class ="normal";
            if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == 1){
                $class = "covered";
            }else if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -1){
                $class ="red";
            }else if( isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -2){
                $class ="orange";
            }
            $html .= '<dd class="' . $class . '">' . htmlspecialchars($line) . '</dd>' . "\n";
        }
        $html .='</dl></div>';
        echo $html;
    }

    public function generateNotCoveredFiles()
    {
        $it = new RecursiveDirectoryIterator(Doctrine::getPath());

        $notCoveredArray = array();
        foreach( new RecursiveIteratorIterator($it) as $file){
            if( strpos($file->getPathname(), ".svn")){
                continue;
            }
            $path = Doctrine::getPath() . DIRECTORY_SEPARATOR;
            $coveredPath = str_replace($path, $this->path, $file->getPathname());
            if( isset($this->coverage[$coveredPath])){
                continue;
						}

						$class = str_replace($path, "", $file->getPathname());
						$class = str_replace(DIRECTORY_SEPARATOR, "_", $class);
						$class = substr($class, 0,-4);
            if (strpos($class, '_Interface')) {
                continue;
            }

            if(!class_exists($class)){
                continue;
            }

            try{
                $refClass = new ReflectionClass($class);
            }catch(Exception $e){
                echo $e->getMessage();
                continue;
{'fraction_non_alphanumeric': 0.1792690233672858, 'fraction_numerical': 0.008747753145596166, 'mean_word_length': 2.357200321802092, 'pattern_counts': {'":': 0, '<': 113, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1719619', 'n_tokens_mistral': 2759, 'n_tokens_neox': 2645, 'n_words': 605}