Passed
Push — master ( 3c4b0d...8511c4 )
by Kris
02:07 queued 25s
created
src/Software/ApacheErrorLogParser.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
         // set 2.2 format by default. Will be changed to 2.4 format, ie:
180 180
         // $this->timeFormat        = 'D M d H:i:s.u Y';
181 181
         // , if the format contains %{u} instead of %t  
182
-        $this->timeFormat        = 'D M d H:i:s Y';
182
+        $this->timeFormat = 'D M d H:i:s Y';
183 183
 
184
-        $this->addFormat('default',                         self::FORMAT_APACHE_2_4_DEFAULT);  
185
-        $this->addFormat('apache2.2 default',               self::FORMAT_APACHE_2_2_DEFAULT);  
186
-        $this->addFormat('apache2.2 extented',              self::FORMAT_APACHE_2_2_EXTENDED);  
187
-        $this->addFormat('apache2.2 referer',               self::FORMAT_APACHE_2_2_REFERER);  
188
-        $this->addFormat('apache2.2 extented referer',      self::FORMAT_APACHE_2_2_EXTENDED_REFERER);  
189
-        $this->addFormat('apache2.4 default',               self::FORMAT_APACHE_2_4_DEFAULT);  
190
-        $this->addFormat('apache2.4 extented',              self::FORMAT_APACHE_2_4_EXTENDED);  
191
-        $this->addFormat('apache2.4 referer',               self::FORMAT_APACHE_2_4_REFEFER);  
192
-        $this->addFormat('apache2.4 extented referer',      self::FORMAT_APACHE_2_4_EXTENDED_REFERER);  
193
-        $this->addFormat('apache2.4 mpm',                   self::FORMAT_APACHE_2_4_MPM);  
194
-        $this->addFormat('apache2.4 mpm extented',          self::FORMAT_APACHE_2_4_MPM_EXTENDED);  
195
-        $this->addFormat('apache2.4 mpm referer',           self::FORMAT_APACHE_2_4_MPM_REFERER);  
184
+        $this->addFormat('default', self::FORMAT_APACHE_2_4_DEFAULT);  
185
+        $this->addFormat('apache2.2 default', self::FORMAT_APACHE_2_2_DEFAULT);  
186
+        $this->addFormat('apache2.2 extented', self::FORMAT_APACHE_2_2_EXTENDED);  
187
+        $this->addFormat('apache2.2 referer', self::FORMAT_APACHE_2_2_REFERER);  
188
+        $this->addFormat('apache2.2 extented referer', self::FORMAT_APACHE_2_2_EXTENDED_REFERER);  
189
+        $this->addFormat('apache2.4 default', self::FORMAT_APACHE_2_4_DEFAULT);  
190
+        $this->addFormat('apache2.4 extented', self::FORMAT_APACHE_2_4_EXTENDED);  
191
+        $this->addFormat('apache2.4 referer', self::FORMAT_APACHE_2_4_REFEFER);  
192
+        $this->addFormat('apache2.4 extented referer', self::FORMAT_APACHE_2_4_EXTENDED_REFERER);  
193
+        $this->addFormat('apache2.4 mpm', self::FORMAT_APACHE_2_4_MPM);  
194
+        $this->addFormat('apache2.4 mpm extented', self::FORMAT_APACHE_2_4_MPM_EXTENDED);  
195
+        $this->addFormat('apache2.4 mpm referer', self::FORMAT_APACHE_2_4_MPM_REFERER);  
196 196
         $this->addFormat('apache2.4 mpm extented referer ', self::FORMAT_APACHE_2_4_MPM_EXTENDED_REFERER);  
197
-        $this->addFormat('apache2.4 mpm tid',               self::FORMAT_APACHE_2_4_MPM_TID);  
198
-        $this->addFormat('apache2.4 mpm tid referer',       self::FORMAT_APACHE_2_4_MPM_TID_REFERER);  
197
+        $this->addFormat('apache2.4 mpm tid', self::FORMAT_APACHE_2_4_MPM_TID);  
198
+        $this->addFormat('apache2.4 mpm tid referer', self::FORMAT_APACHE_2_4_MPM_TID_REFERER);  
199 199
 
200 200
         $this->addPath("/var/log/");
201 201
         $this->addPath("/var/log/apache/");
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         // define patterns
218 218
         // ***************
219 219
 
220
-        $this->addNamedPattern('%%' , 'percent', '\%');
220
+        $this->addNamedPattern('%%', 'percent', '\%');
221 221
                 
222 222
         // %t 	        The current time
223 223
         // %{u}t 	The current time including micro-seconds
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
         
229 229
         // %a 	Client IP address and port of the request (port is not registered by parser). 
230 230
         //      That column may be missing depending of error
231
-        $clientIpPattern = '( \[client (?P<remoteIp>' . self::PATTERN_IP_ALL . ')(:[\d]+|)?\])?';
232
-        $this->addPattern(' \[client %a\]' , $clientIpPattern);
233
-        $this->addPattern(' \[%a\]' ,  $clientIpPattern);
234
-        $this->addPattern(' %a' , $clientIpPattern);
231
+        $clientIpPattern = '( \[client (?P<remoteIp>'.self::PATTERN_IP_ALL.')(:[\d]+|)?\])?';
232
+        $this->addPattern(' \[client %a\]', $clientIpPattern);
233
+        $this->addPattern(' \[%a\]', $clientIpPattern);
234
+        $this->addPattern(' %a', $clientIpPattern);
235 235
 
236 236
         // %A 	Local IP-address and port
237 237
         //      That column may be missing depending of error
238
-        $this->addNamedPattern('%A',  'localIP', self::PATTERN_IP_ALL, false);
238
+        $this->addNamedPattern('%A', 'localIP', self::PATTERN_IP_ALL, false);
239 239
         
240 240
         // %m 	Name of the module logging the message
241 241
         // %l 	Loglevel of the message
242
-        $this->addPattern('\[%m:%l\]',  '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
242
+        $this->addPattern('\[%m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
243 243
         $this->addPattern('\[%-m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
244
-        $this->addPattern('\[%l\]',     '\[(?P<level>[\w:]+)\]');
245
-        $this->addPattern('%l',         '\[(?P<level>[\w:]+)\]');
244
+        $this->addPattern('\[%l\]', '\[(?P<level>[\w:]+)\]');
245
+        $this->addPattern('%l', '\[(?P<level>[\w:]+)\]');
246 246
 
247 247
         // %P 	Process ID of current process (since apache 2.4?)
248 248
         // %T 	Thread ID of current thread
249 249
         $this->addPattern('\[pid %P:tid %T\]', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]'); 
250
-        $this->addPattern('%P %T',             '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]');
250
+        $this->addPattern('%P %T', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]');
251 251
         $this->addPattern('\[pid %P\]', '\[pid (?P<pid>\d+)\]');
252
-        $this->addPattern('\[%P\]',     '\[pid (?P<pid>\d+)\]');   
253
-        $this->addPattern('%P',         '\[pid (?P<pid>\d+)\]');
252
+        $this->addPattern('\[%P\]', '\[pid (?P<pid>\d+)\]');   
253
+        $this->addPattern('%P', '\[pid (?P<pid>\d+)\]');
254 254
         
255 255
         // %E 	APR/OS error status code and string
256 256
         //      That column may be missing depending of error
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
         $this->addPattern(' %F:', '( (?P<fileName>[^ ]+\([\d]+\)):)?');              
262 262
 
263 263
         // %M 	The actual log message
264
-        $this->addNamedPattern('%M',  'message', '.+?');
264
+        $this->addNamedPattern('%M', 'message', '.+?');
265 265
 
266 266
         // referer (may be empty)
267
-        $this->addPattern(' , referer %{Referer}i',   '(, referer: (?P<referer>[^ ]+))?');
268
-        $this->addPattern(', referer %{Referer}i',    '(, referer: (?P<referer>[^ ]+))?');
267
+        $this->addPattern(' , referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?');
268
+        $this->addPattern(', referer %{Referer}i', '(, referer: (?P<referer>[^ ]+))?');
269 269
 
270 270
         // now let default constructor
271 271
         parent::__construct($format, $factory);
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         parent::setFormat($format);
285 285
 
286 286
         // set the correct time format
287
-        if (strpos($this->logFormat, '%{u}t') !== false){
287
+        if (strpos($this->logFormat, '%{u}t') !== false) {
288 288
             $this->timeFormat = 'D M d H:i:s.u Y';
289 289
         }
290 290
     }
Please login to merge, or discard this patch.