Passed
Push — master ( 85d086...14655d )
by Tim
02:47
created
hooks/hook_sanitycheck.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     try {
18 18
         $statconfig = Configuration::getConfig('module_statistics.php');
19 19
     } catch (Exception $e) {
20
-        $hookinfo['errors'][] = '[statistics] Could not get configuration: ' . $e->getMessage();
20
+        $hookinfo['errors'][] = '[statistics] Could not get configuration: '.$e->getMessage();
21 21
         return;
22 22
     }
23 23
 
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
     $inputfile = $statconfig->getValue('inputfile');
26 26
 
27 27
     if (file_exists($statdir)) {
28
-        $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] exists';
28
+        $hookinfo['info'][] = '[statistics] Statistics dir ['.$statdir.'] exists';
29 29
         if (is_writable($statdir)) {
30
-            $hookinfo['info'][] = '[statistics] Statistics dir [' . $statdir . '] is writable';
30
+            $hookinfo['info'][] = '[statistics] Statistics dir ['.$statdir.'] is writable';
31 31
         } else {
32
-            $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] is not writable';
32
+            $hookinfo['errors'][] = '[statistics] Statistics dir ['.$statdir.'] is not writable';
33 33
         }
34 34
     } else {
35
-        $hookinfo['errors'][] = '[statistics] Statistics dir [' . $statdir . '] does not exist';
35
+        $hookinfo['errors'][] = '[statistics] Statistics dir ['.$statdir.'] does not exist';
36 36
     }
37 37
 
38 38
     if (file_exists($inputfile)) {
39
-        $hookinfo['info'][] = '[statistics] Input file [' . $inputfile . '] exists';
39
+        $hookinfo['info'][] = '[statistics] Input file ['.$inputfile.'] exists';
40 40
     } else {
41
-        $hookinfo['errors'][] = '[statistics] Input file [' . $inputfile . '] does not exist';
41
+        $hookinfo['errors'][] = '[statistics] Input file ['.$inputfile.'] does not exist';
42 42
     }
43 43
 }
Please login to merge, or discard this patch.
hooks/hook_cron.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             $aggregator->store($results);
41 41
         }
42 42
     } catch (Exception $e) {
43
-        $message = 'Loganalyzer threw exception: ' . $e->getMessage();
43
+        $message = 'Loganalyzer threw exception: '.$e->getMessage();
44 44
         Logger::warning($message);
45 45
         $croninfo['summary'][] = $message;
46 46
     }
Please login to merge, or discard this patch.
hooks/hook_configpage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @param \SimpleSAML\XHTML\Template &$template The template that we should alter in this hook.
13 13
  */
14
-function statistics_hook_configpage(Template &$template): void
14
+function statistics_hook_configpage(Template&$template): void
15 15
 {
16 16
     $template->data['links'][] = [
17 17
         'href' => Module::getModuleURL('statistics/'),
Please login to merge, or discard this patch.
src/Graph/GoogleCharts.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         foreach ($datasets as $dataset) {
54 54
             $setstr[] = self::extEncode($dataset);
55 55
         }
56
-        return 'e:' . join(',', $setstr);
56
+        return 'e:'.join(',', $setstr);
57 57
     }
58 58
 
59 59
 
@@ -94,31 +94,31 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function show(array $axis, array $axispos, array $datasets, array $maxes): string
96 96
     {
97
-        $labeld = '&chxt=x,y' . '&chxr=0,0,1|1,0,' . $maxes[0];
97
+        $labeld = '&chxt=x,y'.'&chxr=0,0,1|1,0,'.$maxes[0];
98 98
         if (count($datasets) > 1) {
99 99
             if (count($datasets) !== count($maxes)) {
100 100
                 throw new \Exception('Incorrect number of max calculations for graph plotting.');
101 101
             }
102
-            $labeld = '&chxt=x,y,r' . '&chxr=0,0,1|1,0,' . $maxes[0] . '|2,0,' . $maxes[1];
102
+            $labeld = '&chxt=x,y,r'.'&chxr=0,0,1|1,0,'.$maxes[0].'|2,0,'.$maxes[1];
103 103
         }
104 104
 
105
-        $url = 'https://chart.apis.google.com/chart?' .
105
+        $url = 'https://chart.apis.google.com/chart?'.
106 106
             // Dimension of graph. Default is 800x350
107
-            'chs=' . $this->x . 'x' . $this->y .
107
+            'chs='.$this->x.'x'.$this->y.
108 108
 
109 109
             // Dateset values
110
-            '&chd=' . $this->encodedata($datasets) .
110
+            '&chd='.$this->encodedata($datasets).
111 111
 
112 112
             // Fill area...
113
-            '&chco=ff5c00,cca600' .
114
-            '&chls=1,1,0|1,6,3' .
113
+            '&chco=ff5c00,cca600'.
114
+            '&chls=1,1,0|1,6,3'.
115 115
 
116 116
             // chart type is linechart
117
-            '&cht=lc' .
118
-            $labeld .
119
-            '&chxl=0:|' . $this->encodeaxis($axis) . #.$'|1:||top' .
120
-            '&chxp=0,' . join(',', $axispos) .
121
-            '&chg=' . (2400 / (count($datasets[0]) - 1)) . ',-1,3,3'; // lines
117
+            '&cht=lc'.
118
+            $labeld.
119
+            '&chxl=0:|'.$this->encodeaxis($axis).#.$'|1:||top' .
120
+            '&chxp=0,'.join(',', $axispos).
121
+            '&chg='.(2400 / (count($datasets[0]) - 1)).',-1,3,3'; // lines
122 122
 
123 123
         return $url;
124 124
     }
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function showPie(array $axis, array $datasets): string
133 133
     {
134
-        $url = 'https://chart.apis.google.com/chart?' .
134
+        $url = 'https://chart.apis.google.com/chart?'.
135 135
 
136 136
         // Dimension of graph. Default is 800x350
137
-        'chs=' . $this->x . 'x' . $this->y .
137
+        'chs='.$this->x.'x'.$this->y.
138 138
 
139 139
         // Dateset values.
140
-        '&chd=' . $this->encodedata([$datasets]) .
140
+        '&chd='.$this->encodedata([$datasets]).
141 141
 
142 142
         // chart type is linechart
143
-        '&cht=p' .
143
+        '&cht=p'.
144 144
 
145
-        '&chl=' . $this->encodeaxis($axis);
145
+        '&chl='.$this->encodeaxis($axis);
146 146
 
147 147
         return $url;
148 148
     }
Please login to merge, or discard this patch.
src/Ruleset.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
          * Walk through file lists, and get available [rule][fileslot]...
52 52
          */
53 53
         if (!is_dir($statdir)) {
54
-            throw new Exception('Statisics output directory [' . $statdir . '] does not exist.');
54
+            throw new Exception('Statisics output directory ['.$statdir.'] does not exist.');
55 55
         }
56 56
         $filelist = scandir($statdir);
57 57
         $this->available = [];
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             }
66 66
         }
67 67
         if (empty($this->available)) {
68
-            throw new Exception('No aggregated statistics files found in [' . $statdir . ']');
68
+            throw new Exception('No aggregated statistics files found in ['.$statdir.']');
69 69
         }
70 70
 
71 71
         /**
Please login to merge, or discard this patch.
src/DateHandlerMonth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,6 +57,6 @@
 block discarded – undo
57 57
     {
58 58
         $month = ($from % 12) + 1;
59 59
         $year = 2000 + intval(floor($from / 12));
60
-        return $year . '-' . $month;
60
+        return $year.'-'.$month;
61 61
     }
62 62
 }
Please login to merge, or discard this patch.
src/Aggregator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function dumpConfig(): void
64 64
     {
65
-        echo 'Statistics directory   : ' . $this->statdir . "\n";
66
-        echo 'Input file             : ' . $this->inputfile . "\n";
67
-        echo 'Offset                 : ' . $this->offset . "\n";
65
+        echo 'Statistics directory   : '.$this->statdir."\n";
66
+        echo 'Input file             : '.$this->inputfile."\n";
67
+        echo 'Offset                 : '.$this->offset."\n";
68 68
     }
69 69
 
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function debugInfo(): void
74 74
     {
75 75
         // 1024*1024=1048576
76
-        echo 'Memory usage           : ' . number_format(memory_get_usage() / 1048576, 2) . " MB\n";
76
+        echo 'Memory usage           : '.number_format(memory_get_usage() / 1048576, 2)." MB\n";
77 77
     }
78 78
 
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function loadMetadata(): void
83 83
     {
84
-        $filename = $this->statdir . '/.stat.metadata';
84
+        $filename = $this->statdir.'/.stat.metadata';
85 85
         $metadata = null;
86 86
         if (file_exists($filename)) {
87 87
             $metadata = unserialize(file_get_contents($filename));
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $this->metadata['memory'] = memory_get_usage();
108 108
         $this->metadata['lastrun'] = time();
109 109
 
110
-        $filename = $this->statdir . '/.stat.metadata';
110
+        $filename = $this->statdir.'/.stat.metadata';
111 111
         file_put_contents($filename, serialize($this->metadata), LOCK_EX);
112 112
     }
113 113
 
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
         $this->loadMetadata();
123 123
 
124 124
         if (!is_dir($this->statdir)) {
125
-            throw new Exception('Statistics module: output dir does not exist [' . $this->statdir . ']');
125
+            throw new Exception('Statistics module: output dir does not exist ['.$this->statdir.']');
126 126
         }
127 127
 
128 128
         if (!file_exists($this->inputfile)) {
129
-            throw new Exception('Statistics module: input file does not exist [' . $this->inputfile . ']');
129
+            throw new Exception('Statistics module: input file does not exist ['.$this->inputfile.']');
130 130
         }
131 131
 
132 132
         $file = fopen($this->inputfile, 'r');
133 133
 
134 134
         if ($file === false) {
135
-            throw new Exception('Statistics module: unable to open file [' . $this->inputfile . ']');
135
+            throw new Exception('Statistics module: unable to open file ['.$this->inputfile.']');
136 136
         }
137 137
 
138 138
         $logparser = new LogParser(
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
             $action = trim($content[5]);
178 178
 
179 179
             if ($this->fromcmdline && ($i % 10000) == 0) {
180
-                echo "Read line " . $i . "\n";
180
+                echo "Read line ".$i."\n";
181 181
             }
182 182
 
183 183
             if ($debug) {
184 184
                 echo "----------------------------------------\n";
185
-                echo 'Log line: ' . $logline . "\n";
186
-                echo 'Date parse [' . substr($logline, 0, $this->statconfig->getOptionalValue('datelength', 15)) .
187
-                    '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n";
185
+                echo 'Log line: '.$logline."\n";
186
+                echo 'Date parse ['.substr($logline, 0, $this->statconfig->getOptionalValue('datelength', 15)).
187
+                    '] to ['.date(DATE_RFC822, $epoch).']'."\n";
188 188
                 $ret = print_r($content, true);
189 189
                 echo htmlentities($ret);
190 190
                 if ($i >= 13) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                         }
356 356
                     }
357 357
 
358
-                    $filename = $this->statdir . '/' . $rulename . '-' . $tres . '-' . $fileno . '.stat';
358
+                    $filename = $this->statdir.'/'.$rulename.'-'.$tres.'-'.$fileno.'.stat';
359 359
                     if (file_exists($filename)) {
360 360
                         $previousData = unserialize(file_get_contents($filename));
361 361
                         $filledresult = $this->cummulateData($previousData, $filledresult);
Please login to merge, or discard this patch.
src/Controller/Statistics.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                     $data = $dataset->getDebugData();
182 182
                     foreach ($data as $de) {
183 183
                         if (isset($de[1])) {
184
-                            echo '"' . $de[0] . '",' . $de[1] . "\n";
184
+                            echo '"'.$de[0].'",'.$de[1]."\n";
185 185
                         }
186 186
                     }
187 187
                     exit;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             }
240 240
         }
241 241
         if ($type === 'get') {
242
-            return Module::getModuleURL("statistics/") . '?' . http_build_query($vars, '', '&');
242
+            return Module::getModuleURL("statistics/").'?'.http_build_query($vars, '', '&');
243 243
         }
244 244
         return $vars;
245 245
     }
Please login to merge, or discard this patch.
src/LogCleaner.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function dumpConfig(): void
52 52
     {
53
-        echo 'Statistics directory   : ' . $this->statdir . "\n";
54
-        echo 'Input file             : ' . $this->inputfile . "\n";
55
-        echo 'Offset                 : ' . $this->offset . "\n";
53
+        echo 'Statistics directory   : '.$this->statdir."\n";
54
+        echo 'Input file             : '.$this->inputfile."\n";
55
+        echo 'Offset                 : '.$this->offset."\n";
56 56
     }
57 57
 
58 58
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     public function clean(bool $debug = false): array
65 65
     {
66 66
         if (!is_dir($this->statdir)) {
67
-            throw new Exception('Statistics module: output dir does not exist [' . $this->statdir . ']');
67
+            throw new Exception('Statistics module: output dir does not exist ['.$this->statdir.']');
68 68
         }
69 69
 
70 70
         if (!file_exists($this->inputfile)) {
71
-            throw new Exception('Statistics module: input file does not exist [' . $this->inputfile . ']');
71
+            throw new Exception('Statistics module: input file does not exist ['.$this->inputfile.']');
72 72
         }
73 73
 
74 74
         $file = fopen($this->inputfile, 'r');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $content = $logparser->parseContent($logline);
98 98
 
99 99
             if (($i % 10000) == 0) {
100
-                echo "Read line " . $i . "\n";
100
+                echo "Read line ".$i."\n";
101 101
             }
102 102
 
103 103
             $trackid = $content[4];
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 
110 110
             if ($debug) {
111 111
                 echo "----------------------------------------\n";
112
-                echo 'Log line: ' . $logline . "\n";
113
-                echo 'Date parse [' . substr($logline, 0, $this->statconfig->getOptionalValue('datelength', 15)) .
114
-                    '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n";
112
+                echo 'Log line: '.$logline."\n";
113
+                echo 'Date parse ['.substr($logline, 0, $this->statconfig->getOptionalValue('datelength', 15)).
114
+                    '] to ['.date(DATE_RFC822, $epoch).']'."\n";
115 115
                 $ret = print_r($content, true);
116 116
                 echo htmlentities($ret);
117 117
                 if ($i >= 13) {
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function store(array $todelete, string $outputfile): void
149 149
     {
150
-        echo "Preparing to delete [" . count($todelete) . "] trackids\n";
150
+        echo "Preparing to delete [".count($todelete)."] trackids\n";
151 151
 
152 152
         if (!is_dir($this->statdir)) {
153
-            throw new Exception('Statistics module: output dir do not exists [' . $this->statdir . ']');
153
+            throw new Exception('Statistics module: output dir do not exists ['.$this->statdir.']');
154 154
         }
155 155
 
156 156
         if (!file_exists($this->inputfile)) {
157
-            throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']');
157
+            throw new Exception('Statistics module: input file do not exists ['.$this->inputfile.']');
158 158
         }
159 159
 
160 160
         $file = fopen($this->inputfile, 'r');
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             $content = $logparser->parseContent($logline);
187 187
 
188 188
             if (($i % 10000) == 0) {
189
-                echo "Read line " . $i . "\n";
189
+                echo "Read line ".$i."\n";
190 190
             }
191 191
 
192 192
             $trackid = $content[4];
Please login to merge, or discard this patch.