/** * Starts gathering the information for code coverage. * @param string * @return void */ public static function start($file) { self::$file = $file; xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); register_shutdown_function(function () { register_shutdown_function(array(__CLASS__, 'save')); }); }
/** * Starts gathering the information for code coverage. * @param string * @return void */ public static function start($file) { if (!extension_loaded('xdebug')) { throw new \Exception('Code coverage functionality requires Xdebug extension.'); } self::$file = fopen($file, 'a+'); xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); register_shutdown_function(function () { register_shutdown_function(array(__CLASS__, 'save')); }); }
/** * Starts gathering the information for code coverage. * @param string * @return void * @throws \LogicException */ public static function start($file) { if (self::isStarted()) { throw new \LogicException('Code coverage collector has been already started.'); } self::$file = fopen($file, 'c+'); if (defined('PHPDBG_VERSION') && PHP_VERSION_ID >= 70000) { phpdbg_start_oplog(); self::$collector = 'collectPhpDbg'; } elseif (extension_loaded('xdebug')) { xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); self::$collector = 'collectXdebug'; } else { $alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : ''; throw new \LogicException("Code coverage functionality requires Xdebug extension{$alternative}."); } register_shutdown_function(function () { register_shutdown_function([__CLASS__, 'save']); }); }