File tree Expand file tree Collapse file tree 1 file changed +0
-42
lines changed
Expand file tree Collapse file tree 1 file changed +0
-42
lines changed Original file line number Diff line number Diff line change 1717 */
1818final class Xdebug implements Driver
1919{
20- /**
21- * @var array
22- */
23- private $ cacheNumLines = [];
24-
2520 /**
2621 * @var Filter
2722 */
@@ -68,43 +63,6 @@ public function stop(): array
6863
6964 \xdebug_stop_code_coverage ();
7065
71- return $ this ->cleanup ($ data );
72- }
73-
74- private function cleanup (array $ data ): array
75- {
76- foreach (\array_keys ($ data ) as $ file ) {
77- unset($ data [$ file ][0 ]);
78-
79- if (!$ this ->filter ->isFile ($ file )) {
80- continue ;
81- }
82-
83- $ numLines = $ this ->getNumberOfLinesInFile ($ file );
84-
85- foreach (\array_keys ($ data [$ file ]) as $ line ) {
86- if ($ line > $ numLines ) {
87- unset($ data [$ file ][$ line ]);
88- }
89- }
90- }
91-
9266 return $ data ;
9367 }
94-
95- private function getNumberOfLinesInFile (string $ fileName ): int
96- {
97- if (!isset ($ this ->cacheNumLines [$ fileName ])) {
98- $ buffer = \file_get_contents ($ fileName );
99- $ lines = \substr_count ($ buffer , "\n" );
100-
101- if (\substr ($ buffer , -1 ) !== "\n" ) {
102- $ lines ++;
103- }
104-
105- $ this ->cacheNumLines [$ fileName ] = $ lines ;
106- }
107-
108- return $ this ->cacheNumLines [$ fileName ];
109- }
11068}
You can’t perform that action at this time.
0 commit comments