public static function apply($report, $tests, array $options = array())
{
$defaults = array('method' => 'run');
$options += $defaults;
if (!function_exists('xdebug_start_code_coverage')) {
$msg = "Xdebug not installed. Please install Xdebug before running code coverage.";
throw new RuntimeException($msg);
}
$filter = function ($self, $params, $chain) use($report, $options) {
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$chain->next($self, $params, $chain);
$results = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
$report->collect(__CLASS__, array($self->subject() => $results));
};
$tests->invoke('applyFilter', array($options['method'], $filter));
return $tests;
}