Passed
Push — master ( cb66dc...a95233 )
by Tim
05:42
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.
lib/StatDataset.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                 'Statistics\FieldPresentation'
346 346
             );
347 347
             if (!class_exists($classname)) {
348
-                throw new Exception('Could not find field presentation plugin [' . $classname . ']: No class found');
348
+                throw new Exception('Could not find field presentation plugin ['.$classname.']: No class found');
349 349
             }
350 350
             $presentationHandler = new $classname($availdelimiters, $fieldpresConfig->getValue('config'), $t);
351 351
 
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
         $rules = Arrays::arrayize($this->ruleid);
388 388
         foreach ($rules as $rule) {
389 389
             // Get file and extract results.
390
-            $resultFileName = $statdir . '/' . $rule . '-' . $this->timeres . '-' . $this->fileslot . '.stat';
390
+            $resultFileName = $statdir.'/'.$rule.'-'.$this->timeres.'-'.$this->fileslot.'.stat';
391 391
             if (!file_exists($resultFileName)) {
392
-                throw new Exception('Aggregated statitics file [' . $resultFileName . '] not found.');
392
+                throw new Exception('Aggregated statitics file ['.$resultFileName.'] not found.');
393 393
             }
394 394
             if (!is_readable($resultFileName)) {
395
-                throw new Exception('Could not read statitics file [' . $resultFileName . ']. Bad file permissions?');
395
+                throw new Exception('Could not read statitics file ['.$resultFileName.']. Bad file permissions?');
396 396
             }
397 397
             $resultfile = file_get_contents($resultFileName);
398 398
             $newres = unserialize($resultfile);
399 399
             if (empty($newres)) {
400
-                throw new Exception('Aggregated statistics in file [' . $resultFileName . '] was empty.');
400
+                throw new Exception('Aggregated statistics in file ['.$resultFileName.'] was empty.');
401 401
             }
402 402
             $resarray[] = $newres;
403 403
         }
Please login to merge, or discard this patch.
lib/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.
lib/Aggregator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function dumpConfig(): void
66 66
     {
67
-        echo 'Statistics directory   : ' . $this->statdir . "\n";
68
-        echo 'Input file             : ' . $this->inputfile . "\n";
69
-        echo 'Offset                 : ' . $this->offset . "\n";
67
+        echo 'Statistics directory   : '.$this->statdir."\n";
68
+        echo 'Input file             : '.$this->inputfile."\n";
69
+        echo 'Offset                 : '.$this->offset."\n";
70 70
     }
71 71
 
72 72
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function debugInfo(): void
77 77
     {
78 78
         // 1024*1024=1048576
79
-        echo 'Memory usage           : ' . number_format(memory_get_usage() / 1048576, 2) . " MB\n";
79
+        echo 'Memory usage           : '.number_format(memory_get_usage() / 1048576, 2)." MB\n";
80 80
     }
81 81
 
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function loadMetadata(): void
87 87
     {
88
-        $filename = $this->statdir . '/.stat.metadata';
88
+        $filename = $this->statdir.'/.stat.metadata';
89 89
         $metadata = null;
90 90
         if (file_exists($filename)) {
91 91
             $metadata = unserialize(file_get_contents($filename));
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $this->metadata['memory'] = memory_get_usage();
113 113
         $this->metadata['lastrun'] = time();
114 114
 
115
-        $filename = $this->statdir . '/.stat.metadata';
115
+        $filename = $this->statdir.'/.stat.metadata';
116 116
         file_put_contents($filename, serialize($this->metadata), LOCK_EX);
117 117
     }
118 118
 
@@ -127,17 +127,17 @@  discard block
 block discarded – undo
127 127
         $this->loadMetadata();
128 128
 
129 129
         if (!is_dir($this->statdir)) {
130
-            throw new Exception('Statistics module: output dir does not exist [' . $this->statdir . ']');
130
+            throw new Exception('Statistics module: output dir does not exist ['.$this->statdir.']');
131 131
         }
132 132
 
133 133
         if (!file_exists($this->inputfile)) {
134
-            throw new Exception('Statistics module: input file does not exist [' . $this->inputfile . ']');
134
+            throw new Exception('Statistics module: input file does not exist ['.$this->inputfile.']');
135 135
         }
136 136
 
137 137
         $file = fopen($this->inputfile, 'r');
138 138
 
139 139
         if ($file === false) {
140
-            throw new Exception('Statistics module: unable to open file [' . $this->inputfile . ']');
140
+            throw new Exception('Statistics module: unable to open file ['.$this->inputfile.']');
141 141
         }
142 142
 
143 143
         $logparser = new LogParser(
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
             $action = trim($content[5]);
183 183
 
184 184
             if ($this->fromcmdline && ($i % 10000) == 0) {
185
-                echo "Read line " . $i . "\n";
185
+                echo "Read line ".$i."\n";
186 186
             }
187 187
 
188 188
             if ($debug) {
189 189
                 echo "----------------------------------------\n";
190
-                echo 'Log line: ' . $logline . "\n";
191
-                echo 'Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) .
192
-                    '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n";
190
+                echo 'Log line: '.$logline."\n";
191
+                echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)).
192
+                    '] to ['.date(DATE_RFC822, $epoch).']'."\n";
193 193
                 /** @var string $ret */
194 194
                 $ret = print_r($content, true);
195 195
                 echo htmlentities($ret);
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                         }
363 363
                     }
364 364
 
365
-                    $filename = $this->statdir . '/' . $rulename . '-' . $tres . '-' . $fileno . '.stat';
365
+                    $filename = $this->statdir.'/'.$rulename.'-'.$tres.'-'.$fileno.'.stat';
366 366
                     if (file_exists($filename)) {
367 367
                         $previousData = unserialize(file_get_contents($filename));
368 368
                         $filledresult = $this->cummulateData($previousData, $filledresult);
Please login to merge, or discard this patch.
lib/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.
lib/LogCleaner.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function dumpConfig(): void
54 54
     {
55
-        echo 'Statistics directory   : ' . $this->statdir . "\n";
56
-        echo 'Input file             : ' . $this->inputfile . "\n";
57
-        echo 'Offset                 : ' . $this->offset . "\n";
55
+        echo 'Statistics directory   : '.$this->statdir."\n";
56
+        echo 'Input file             : '.$this->inputfile."\n";
57
+        echo 'Offset                 : '.$this->offset."\n";
58 58
     }
59 59
 
60 60
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     public function clean(bool $debug = false): array
67 67
     {
68 68
         if (!is_dir($this->statdir)) {
69
-            throw new Exception('Statistics module: output dir do not exists [' . $this->statdir . ']');
69
+            throw new Exception('Statistics module: output dir do not exists ['.$this->statdir.']');
70 70
         }
71 71
 
72 72
         if (!file_exists($this->inputfile)) {
73
-            throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']');
73
+            throw new Exception('Statistics module: input file do not exists ['.$this->inputfile.']');
74 74
         }
75 75
 
76 76
         $file = fopen($this->inputfile, 'r');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             $content = $logparser->parseContent($logline);
100 100
 
101 101
             if (($i % 10000) == 0) {
102
-                echo "Read line " . $i . "\n";
102
+                echo "Read line ".$i."\n";
103 103
             }
104 104
 
105 105
             $trackid = $content[4];
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 
112 112
             if ($debug) {
113 113
                 echo "----------------------------------------\n";
114
-                echo 'Log line: ' . $logline . "\n";
115
-                echo 'Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) .
116
-                    '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n";
114
+                echo 'Log line: '.$logline."\n";
115
+                echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)).
116
+                    '] to ['.date(DATE_RFC822, $epoch).']'."\n";
117 117
                 /** @var string $ret */
118 118
                 $ret = print_r($content, true);
119 119
                 echo htmlentities($ret);
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function store(array $todelete, string $outputfile): void
153 153
     {
154
-        echo "Preparing to delete [" . count($todelete) . "] trackids\n";
154
+        echo "Preparing to delete [".count($todelete)."] trackids\n";
155 155
 
156 156
         if (!is_dir($this->statdir)) {
157
-            throw new Exception('Statistics module: output dir do not exists [' . $this->statdir . ']');
157
+            throw new Exception('Statistics module: output dir do not exists ['.$this->statdir.']');
158 158
         }
159 159
 
160 160
         if (!file_exists($this->inputfile)) {
161
-            throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']');
161
+            throw new Exception('Statistics module: input file do not exists ['.$this->inputfile.']');
162 162
         }
163 163
 
164 164
         $file = fopen($this->inputfile, 'r');
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $content = $logparser->parseContent($logline);
191 191
 
192 192
             if (($i % 10000) == 0) {
193
-                echo "Read line " . $i . "\n";
193
+                echo "Read line ".$i."\n";
194 194
             }
195 195
 
196 196
             $trackid = $content[4];
Please login to merge, or discard this patch.