99 */
1010
1111/**
12- * Driver for Phpdbg 's code coverage functionality.
12+ * Driver for PHPDBG 's code coverage functionality.
1313 *
1414 * @since Class available since Release 2.2.0
1515 * @codeCoverageIgnore
1616 */
17- class PHP_CodeCoverage_Driver_Phpdbg implements PHP_CodeCoverage_Driver
17+ class PHP_CodeCoverage_Driver_PHPDBG implements PHP_CodeCoverage_Driver
1818{
1919 /**
2020 * Constructor.
2121 */
2222 public function __construct ()
2323 {
2424 if (PHP_SAPI !== 'phpdbg ' ) {
25- throw new PHP_CodeCoverage_Exception ('This driver requires the phpdbg sapi ' );
25+ throw new PHP_CodeCoverage_Exception (
26+ 'This driver requires the PHPDBG SAPI '
27+ );
2628 }
2729
28- if (version_compare (phpversion (), '7.0 ' , '< ' )) {
29- // actually we require the phpdbg version shipped with php7, not php7 itself
30+ if (!function_exists ('phpdbg_start_oplog ' )) {
3031 throw new PHP_CodeCoverage_Exception (
31- 'phpdbg based code coverage requires at least php7 '
32+ 'This build of PHPDBG does not support code coverage '
3233 );
3334 }
3435 }
@@ -55,9 +56,15 @@ public function stop()
5556 if ($ fetchedLines == array ()) {
5657 $ sourceLines = phpdbg_get_executable ();
5758 } else {
58- $ newFiles = array_diff (get_included_files (), array_keys ($ fetchedLines ));
59+ $ newFiles = array_diff (
60+ get_included_files (),
61+ array_keys ($ fetchedLines )
62+ );
63+
5964 if ($ newFiles ) {
60- $ sourceLines = phpdbg_get_executable (array ("files " => $ newFiles ));
65+ $ sourceLines = phpdbg_get_executable (
66+ array ('files ' => $ newFiles )
67+ );
6168 } else {
6269 $ sourceLines = array ();
6370 }
@@ -69,11 +76,9 @@ public function stop()
6976 }
7077 }
7178
72- $ fetchedLines += $ sourceLines ;
73-
74- $ data = $ this ->detectExecutedLines ($ fetchedLines , $ dbgData );
79+ $ fetchedLines = array_merge ($ fetchedLines , $ sourceLines );
7580
76- return $ data ;
81+ return $ this -> detectExecutedLines ( $ fetchedLines , $ dbgData ) ;
7782 }
7883
7984 /**
0 commit comments