File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -88,4 +88,52 @@ protected function doStop()
88
88
89
89
return $ data ;
90
90
}
91
+
92
+ /**
93
+ * {@inheritdoc}
94
+ *
95
+ * @param array $data
96
+ */
97
+ protected function cleanup (array &$ data )
98
+ {
99
+ foreach (array_keys ($ data ) as $ file ) {
100
+ if (!file_exists ($ file )) {
101
+ continue ;
102
+ }
103
+
104
+ $ lines = $ this ->getLines ($ file );
105
+ foreach ($ lines as $ line => $ dead ) {
106
+ if ($ dead ) {
107
+ $ data [$ file ][$ line ] = -2 ;
108
+ } elseif (isset ($ data [$ file ][$ line ])) {
109
+ $ data [$ file ][$ line ] = 1 ;
110
+ } else {
111
+ $ data [$ file ][$ line ] = -1 ;
112
+ }
113
+ }
114
+ }
115
+ return $ data ;
116
+ }
117
+
118
+ /**
119
+ * Returns file lines anad mark some as dead
120
+ *
121
+ * @param string $file
122
+ * @return array
123
+ */
124
+ private function getLines ($ file )
125
+ {
126
+ $ buffer = file ($ file );
127
+ $ lines = array ();
128
+
129
+ foreach ($ buffer as $ line => $ content ) {
130
+ if (trim ($ content ) === '} ' ) {
131
+ $ lines [$ line + 1 ] = true ;
132
+ continue ;
133
+ }
134
+ $ lines [$ line + 1 ] = false ;
135
+ }
136
+ return $ lines ;
137
+ }
138
+
91
139
}
You can’t perform that action at this time.
0 commit comments