- print_r: documentation ( source)
- file: documentation ( source)
<?php
class Ololo
{
public function omg($a, $b, $c, $d, $e)
{
$a + $b + $c;
}
}
xdebug_start_code_coverage();
$lang_id = $source = $lexemes_ids = $deadline_ts = $skip_lexem_ids = 1;
$Obj = new Ololo();
$Obj->omg(
$lang_id,
$source,
$lexemes_ids,
$deadline_ts,
$skip_lexem_ids
);
$coverage = xdebug_get_code_coverage()[__FILE__];
xdebug_stop_code_coverage();
$lines = file(__FILE__);
foreach ($lines as $idx => $l) {
echo (isset($coverage[$idx + 1]) ? "\e[32m" : "\e[31m") . "$idx:$l";
}
print_r($coverage);