/** * Activates or deactivates filtering. * * @param $filter boolean * @throws InvalidArgumentException * @since Method available since Release 3.0.0 */ public static function setFilter($filter) { if (is_bool($filter)) { self::$filter = $filter; } else { throw PHPCoverage_Util_InvalidArgumentHelper::factory(1, 'boolean'); } }
<?php defined('PHPCOVERAGE_HOME') || define('PHPCOVERAGE_HOME', realpath(dirname(__FILE__)) . '/../'); require_once PHPCOVERAGE_HOME . 'Util/Filter.php'; PHPCoverage_Util_Filter::addFileToFilter(__FILE__, 'PHPCoverage'); class PHPCoverageListener { protected $_includePaths; protected $_excludePaths; protected $_uncoveredFiles; protected $_coverageData; protected $_phpExtensions; protected $_logFile; public function __construct($includePaths = array("."), $excludePaths = array()) { $this->_phpExtensions = array('php', 'tpl', 'inc'); $this->_uncoveredFiles = array(); $this->_includePaths = $includePaths; $this->_excludePaths = $excludePaths; $this->_logFile = PHPCOVERAGE_HOME . 'logs/coverage_log'; $this->startListener(); } public function __destruct() { $this->stopListener(); } protected function startListener() { if (extension_loaded("xdebug")) { xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); return true;
/** * Stops the collection of loaded files and adds * the names of the loaded files to the blacklist. * * @return array * @since Method available since Release 3.4.6 */ public static function collectEndAndAddToBlacklist() { foreach (self::collectEnd() as $blacklistedFile) { PHPCoverage_Util_Filter::addFileToFilter($blacklistedFile, 'PHPCoverage'); } }