Passed
Pull Request — master (#5)
by Kris
02:27
created
src/Software/ApacheErrorLogParser.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
         // set 2.2 format by default. Will be changed to 2.4 format, ie:
145 145
         // $this->timeFormat        = 'D M d H:i:s.u Y';
146 146
         // , if the format contain %{u} insted of %t  
147
-        $this->timeFormat        = 'D M d H:i:s Y';
148
-
149
-        $this->addFormat('default',                         self::FORMAT_APACHE_2_4_DEFAULT);  
150
-        $this->addFormat('apache2.2 default',               self::FORMAT_APACHE_2_2_DEFAULT);  
151
-        $this->addFormat('apache2.2 extented',              self::FORMAT_APACHE_2_2_EXTENDED);  
152
-        $this->addFormat('apache2.2 referer',               self::FORMAT_APACHE_2_2_REFERER);  
153
-        $this->addFormat('apache2.2 referer extented',      self::FORMAT_APACHE_2_2_REFERER_EXTENDED);  
154
-        $this->addFormat('apache2.4 default',               self::FORMAT_APACHE_2_4_DEFAULT);  
155
-        $this->addFormat('apache2.4 extented',              self::FORMAT_APACHE_2_4_EXTENDED);  
156
-        $this->addFormat('apache2.4 npm',                   self::FORMAT_APACHE_2_4_MPM);  
157
-        $this->addFormat('apache2.4 npm extented',          self::FORMAT_APACHE_2_4_MPM_EXTENDED);  
158
-        $this->addFormat('apache2.4 npm referer',           self::FORMAT_APACHE_2_4_MPM_REFERER);  
159
-        $this->addFormat('apache2.4 npm referer extented',  self::FORMAT_APACHE_2_4_MPM_REFERER_EXTENDED);  
160
-        $this->addFormat('apache2.4 npm tid',               self::FORMAT_APACHE_2_4_MPM_TID);  
161
-        $this->addFormat('apache2.4 npm tid referer',       self::FORMAT_APACHE_2_4_MPM_TID_REFERER);  
147
+        $this->timeFormat = 'D M d H:i:s Y';
148
+
149
+        $this->addFormat('default', self::FORMAT_APACHE_2_4_DEFAULT);  
150
+        $this->addFormat('apache2.2 default', self::FORMAT_APACHE_2_2_DEFAULT);  
151
+        $this->addFormat('apache2.2 extented', self::FORMAT_APACHE_2_2_EXTENDED);  
152
+        $this->addFormat('apache2.2 referer', self::FORMAT_APACHE_2_2_REFERER);  
153
+        $this->addFormat('apache2.2 referer extented', self::FORMAT_APACHE_2_2_REFERER_EXTENDED);  
154
+        $this->addFormat('apache2.4 default', self::FORMAT_APACHE_2_4_DEFAULT);  
155
+        $this->addFormat('apache2.4 extented', self::FORMAT_APACHE_2_4_EXTENDED);  
156
+        $this->addFormat('apache2.4 npm', self::FORMAT_APACHE_2_4_MPM);  
157
+        $this->addFormat('apache2.4 npm extented', self::FORMAT_APACHE_2_4_MPM_EXTENDED);  
158
+        $this->addFormat('apache2.4 npm referer', self::FORMAT_APACHE_2_4_MPM_REFERER);  
159
+        $this->addFormat('apache2.4 npm referer extented', self::FORMAT_APACHE_2_4_MPM_REFERER_EXTENDED);  
160
+        $this->addFormat('apache2.4 npm tid', self::FORMAT_APACHE_2_4_MPM_TID);  
161
+        $this->addFormat('apache2.4 npm tid referer', self::FORMAT_APACHE_2_4_MPM_TID_REFERER);  
162 162
 
163 163
         $this->addPath("/var/log/");
164 164
         $this->addPath("/var/log/apache/");
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         // define patterns
181 181
         // ***************
182 182
 
183
-        $this->addNamedPattern('%%' , 'percent', '\%');
183
+        $this->addNamedPattern('%%', 'percent', '\%');
184 184
                 
185 185
         // %t 	        The current time
186 186
         // %{u}t 	The current time including micro-seconds
@@ -191,29 +191,29 @@  discard block
 block discarded – undo
191 191
         
192 192
         // %a 	Client IP address and port of the request (port is not registered by parser). 
193 193
         //      That column may be missing depending of error
194
-        $clientIpPattern = '( \[client (?P<remoteIp>' . self::PATTERN_IP_ALL . ')(:[\d]+|)?\])?';
195
-        $this->addPattern(' \[client %a\]' , $clientIpPattern);
196
-        $this->addPattern(' \[%a\]' ,  $clientIpPattern);
197
-        $this->addPattern(' %a' , $clientIpPattern);
194
+        $clientIpPattern = '( \[client (?P<remoteIp>'.self::PATTERN_IP_ALL.')(:[\d]+|)?\])?';
195
+        $this->addPattern(' \[client %a\]', $clientIpPattern);
196
+        $this->addPattern(' \[%a\]', $clientIpPattern);
197
+        $this->addPattern(' %a', $clientIpPattern);
198 198
 
199 199
         // %A 	Local IP-address and port
200 200
         //      That column may be missing depending of error
201
-        $this->addNamedPattern('%A',  'localIP', self::PATTERN_IP_ALL, false);
201
+        $this->addNamedPattern('%A', 'localIP', self::PATTERN_IP_ALL, false);
202 202
         
203 203
         // %m 	Name of the module logging the message
204 204
         // %l 	Loglevel of the message
205
-        $this->addPattern('\[%m:%l\]',  '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
205
+        $this->addPattern('\[%m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
206 206
         $this->addPattern('\[%-m:%l\]', '\[(?<module>.+?)?:(?P<level>[\w]+)\]');
207
-        $this->addPattern('\[%l\]',     '\[(?P<level>[\w:]+)\]');
208
-        $this->addPattern('%l',         '\[(?P<level>[\w:]+)\]');
207
+        $this->addPattern('\[%l\]', '\[(?P<level>[\w:]+)\]');
208
+        $this->addPattern('%l', '\[(?P<level>[\w:]+)\]');
209 209
 
210 210
         // %P 	Process ID of current process (since apache 2.4?)
211 211
         // %T 	Thread ID of current thread
212 212
         $this->addPattern('\[pid %P:tid %T\]', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]'); 
213
-        $this->addPattern('%P %T',             '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]');
213
+        $this->addPattern('%P %T', '\[pid (?P<pid>\d+):tid (?P<tid>\d+)\]');
214 214
         $this->addPattern('\[pid %P\]', '\[pid (?P<pid>\d+)\]');
215
-        $this->addPattern('\[%P\]',     '\[pid (?P<pid>\d+)\]');   
216
-        $this->addPattern('%P',         '\[pid (?P<pid>\d+)\]');
215
+        $this->addPattern('\[%P\]', '\[pid (?P<pid>\d+)\]');   
216
+        $this->addPattern('%P', '\[pid (?P<pid>\d+)\]');
217 217
         
218 218
         // %E 	APR/OS error status code and string
219 219
         //      That column may be missing depending of error
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $this->addPattern(' %F:', '( (?P<fileName>[^ ]+\([\d]+\)):)?');              
225 225
 
226 226
         // %M 	The actual log message
227
-        $this->addNamedPattern('%M',  'message', '.+?');
227
+        $this->addNamedPattern('%M', 'message', '.+?');
228 228
 
229 229
         // 
230 230
         //$this->addNamedPattern(', referer %{Referer}i', 'referer', '', false);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         parent::setFormat($format);
247 247
 
248 248
         // set the correct time format
249
-        if (strpos($this->logFormat, '%{u}t') !== false){
249
+        if (strpos($this->logFormat, '%{u}t') !== false) {
250 250
             $this->timeFormat = 'D M d H:i:s.u Y';
251 251
         }
252 252
     }
Please login to merge, or discard this patch.