Passed
Push — master ( 906528...cb0b0b )
by Chubarov
04:49
created
panel/dist/index.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $app = new Slim\App();
9 9
 // --------------
10
-$app->add(function ($req, $res, $next) {
10
+$app->add(function($req, $res, $next) {
11 11
     $response = $next($req, $res);
12 12
     return $response
13 13
         ->withHeader('Access-Control-Allow-Origin', '*')
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 // --------
18 18
 
19 19
 
20
-$app->get('/', function (Request $request, Response $response) {
20
+$app->get('/', function(Request $request, Response $response) {
21 21
     require_once('index.html');
22 22
 });
23
-$app->get('/api/statistic-request', function (Request $request, Response $response) {
24
-    $data['date']          = [];
23
+$app->get('/api/statistic-request', function(Request $request, Response $response) {
24
+    $data['date'] = [];
25 25
     $data['durations'] = [];
26 26
     $dateList     = [];
27 27
     $durationList = [];
28 28
 
29 29
     array_map(function($file) use (&$dateList, &$data, &$durationList){
30
-        preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', file_get_contents(PATH .'/'. $file), $matchesDate);
31
-        preg_match_all( '/:([0-9]\.[0-9]+)/', file_get_contents(PATH .'/'. $file), $matchesDuration);
30
+        preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', file_get_contents(PATH . '/' . $file), $matchesDate);
31
+        preg_match_all('/:([0-9]\.[0-9]+)/', file_get_contents(PATH . '/' . $file), $matchesDuration);
32 32
         $data['date']      = array_merge($data['date'], array_shift($matchesDate));
33 33
         $data['durations'] = array_merge($data['durations'], $matchesDuration[1]);
34 34
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     return $response->withJson(json_encode($data), 200);
38 38
 });
39 39
 
40
-$app->post('/api/filterDates', function (Request $request, Response $response) {
40
+$app->post('/api/filterDates', function(Request $request, Response $response) {
41 41
 
42 42
     $data['date']     = [];
43 43
     $data['durations'] = [];
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
         array_map(function($line) use ($request, &$dateList, &$data, &$durationList){
48 48
             if (preg_match("/{$request->getParams()['date']}/", $line))
49 49
             {
50
-                preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', $line, $matchesDate);
51
-                preg_match_all( '/:([0-9]\.[0-9]+)/', $line, $matchesDuration);
50
+                preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', $line, $matchesDate);
51
+                preg_match_all('/:([0-9]\.[0-9]+)/', $line, $matchesDuration);
52 52
                 $data['date']      = array_merge($data['date'], array_shift($matchesDate));
53
-                $data['durations'] = array_merge( $data['durations'], $matchesDuration[1]);
53
+                $data['durations'] = array_merge($data['durations'], $matchesDuration[1]);
54 54
             }
55
-        }, explode(PHP_EOL, file_get_contents(PATH .'/'. $file)));
55
+        }, explode(PHP_EOL, file_get_contents(PATH . '/' . $file)));
56 56
     }, getFiles(PATH));
57 57
 
58 58
     return $response->withJson(json_encode($data), 200);
59 59
 });
60 60
 
61
-$app->get('/api/listDates', function (Request $request, Response $response) {
61
+$app->get('/api/listDates', function(Request $request, Response $response) {
62 62
     $dateList         = [];
63 63
     $data['date']     = [];
64 64
     array_map(function($file) use (&$dateList, &$data){
65
-        preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}/', file_get_contents(PATH .'/'. $file), $matchesDate);
66
-        $data['date']      = array_merge( $data['date'], array_shift($matchesDate));
65
+        preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', file_get_contents(PATH . '/' . $file), $matchesDate);
66
+        $data['date'] = array_merge($data['date'], array_shift($matchesDate));
67 67
     }, getFiles(PATH));
68 68
     $data['date'] = array_unique($data['date']);
69 69
     return $response->withJson(json_encode($data), 200);
Please login to merge, or discard this patch.