Conditions | 8 |
Paths | 20 |
Total Lines | 43 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public static function findSpacesInFiles($files) |
||
14 | { |
||
15 | echo '<pre>'; |
||
16 | echo "Finding opened or closed tags ...\n\n"; |
||
17 | |||
18 | $openings = []; |
||
19 | $closings = []; |
||
20 | foreach ($files as $file) { |
||
21 | $content = file_get_contents($file); |
||
22 | |||
23 | $matches = null; |
||
24 | preg_match_all(self::REGEX_OPENING, $content, $matches); |
||
25 | |||
26 | if (!empty($matches[0])) { |
||
27 | $openings[] = $file; |
||
28 | } |
||
29 | |||
30 | $matches = null; |
||
31 | preg_match_all(self::REGEX_CLOSING, $content, $matches); |
||
32 | |||
33 | if (!empty($matches[0])) { |
||
34 | $closings[] = $file; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | if (!empty($openings)) { |
||
39 | echo "Files with opening tags that may need fixing\n"; |
||
40 | foreach ($openings as $file) { |
||
41 | echo "$file\n"; |
||
42 | } |
||
43 | echo "***\n"; |
||
44 | } |
||
45 | if (!empty($closings)) { |
||
46 | echo "Files with closing tags that may need fixing\n"; |
||
47 | foreach ($closings as $file) { |
||
48 | echo "$file\n"; |
||
49 | } |
||
50 | echo "***\n"; |
||
51 | } |
||
52 | |||
53 | echo "\nDone!"; |
||
54 | echo '</pre>'; |
||
55 | die(); |
||
|
|||
56 | } |
||
64 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.