Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerPatternParser.php 5 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -237,6 +237,9 @@
 block discarded – undo
237 237
 		return $this->head;
238 238
 	}
239 239
 
240
+	/**
241
+	 * @param string $c
242
+	 */
240 243
 	public function finalizeConverter($c) {
241 244
 		$pc = null;
242 245
 		switch($c) {
Please login to merge, or discard this patch.
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * Most of the work of the {@link LoggerPatternLayout} class 
@@ -33,309 +33,309 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class LoggerPatternParser {
35 35
 
36
-	const ESCAPE_CHAR = '%';
36
+    const ESCAPE_CHAR = '%';
37 37
 	
38
-	const LITERAL_STATE = 0;
39
-	const CONVERTER_STATE = 1;
40
-	const MINUS_STATE = 2;
41
-	const DOT_STATE = 3;
42
-	const MIN_STATE = 4;
43
-	const MAX_STATE = 5;
38
+    const LITERAL_STATE = 0;
39
+    const CONVERTER_STATE = 1;
40
+    const MINUS_STATE = 2;
41
+    const DOT_STATE = 3;
42
+    const MIN_STATE = 4;
43
+    const MAX_STATE = 5;
44 44
 	
45
-	const FULL_LOCATION_CONVERTER = 1000;
46
-	const METHOD_LOCATION_CONVERTER = 1001;
47
-	const CLASS_LOCATION_CONVERTER = 1002;
48
-	const FILE_LOCATION_CONVERTER = 1003;
49
-	const LINE_LOCATION_CONVERTER = 1004;
45
+    const FULL_LOCATION_CONVERTER = 1000;
46
+    const METHOD_LOCATION_CONVERTER = 1001;
47
+    const CLASS_LOCATION_CONVERTER = 1002;
48
+    const FILE_LOCATION_CONVERTER = 1003;
49
+    const LINE_LOCATION_CONVERTER = 1004;
50 50
 	
51
-	const RELATIVE_TIME_CONVERTER = 2000;
52
-	const THREAD_CONVERTER = 2001;
53
-	const LEVEL_CONVERTER = 2002;
54
-	const NDC_CONVERTER = 2003;
55
-	const MESSAGE_CONVERTER = 2004;
51
+    const RELATIVE_TIME_CONVERTER = 2000;
52
+    const THREAD_CONVERTER = 2001;
53
+    const LEVEL_CONVERTER = 2002;
54
+    const NDC_CONVERTER = 2003;
55
+    const MESSAGE_CONVERTER = 2004;
56 56
 	
57
-	const DATE_FORMAT_ISO8601 = 'Y-m-d H:i:s,u'; 
58
-	const DATE_FORMAT_ABSOLUTE = 'H:i:s';
59
-	const DATE_FORMAT_DATE = 'd M Y H:i:s,u';
57
+    const DATE_FORMAT_ISO8601 = 'Y-m-d H:i:s,u'; 
58
+    const DATE_FORMAT_ABSOLUTE = 'H:i:s';
59
+    const DATE_FORMAT_DATE = 'd M Y H:i:s,u';
60 60
 
61
-	private $state;
62
-	private $currentLiteral;
63
-	private $patternLength;
64
-	private $i;
61
+    private $state;
62
+    private $currentLiteral;
63
+    private $patternLength;
64
+    private $i;
65 65
 	
66
-	/**
67
-	 * @var LoggerPatternConverter
68
-	 */
69
-	private $head = null;
66
+    /**
67
+     * @var LoggerPatternConverter
68
+     */
69
+    private $head = null;
70 70
 	 
71
-	/**
72
-	 * @var LoggerPatternConverter
73
-	 */
74
-	private $tail = null;
71
+    /**
72
+     * @var LoggerPatternConverter
73
+     */
74
+    private $tail = null;
75 75
 	
76
-	/**
77
-	 * @var LoggerFormattingInfo
78
-	 */
79
-	private $formattingInfo;
76
+    /**
77
+     * @var LoggerFormattingInfo
78
+     */
79
+    private $formattingInfo;
80 80
 	
81
-	/**
82
-	 * @var string pattern to parse
83
-	 */
84
-	private $pattern;
81
+    /**
82
+     * @var string pattern to parse
83
+     */
84
+    private $pattern;
85 85
 
86
-	/**
87
-	 * Constructor 
88
-	 *
89
-	 * @param string $pattern
90
-	 */
91
-	public function __construct($pattern) {
92
-		$this->pattern = $pattern;
93
-		$this->patternLength =	strlen($pattern);
94
-		$this->formattingInfo = new LoggerFormattingInfo();
95
-		$this->state = self::LITERAL_STATE;
96
-	}
86
+    /**
87
+     * Constructor 
88
+     *
89
+     * @param string $pattern
90
+     */
91
+    public function __construct($pattern) {
92
+        $this->pattern = $pattern;
93
+        $this->patternLength =	strlen($pattern);
94
+        $this->formattingInfo = new LoggerFormattingInfo();
95
+        $this->state = self::LITERAL_STATE;
96
+    }
97 97
 
98
-	/**
99
-	 * @param LoggerPatternConverter $pc
100
-	 */
101
-	public function addToList($pc) {
102
-		if($this->head == null) {
103
-			$this->head = $pc;
104
-			$this->tail = $this->head;
105
-		} else {
106
-			$this->tail->next = $pc;
107
-			$this->tail = $this->tail->next;
108
-		}
109
-	}
98
+    /**
99
+     * @param LoggerPatternConverter $pc
100
+     */
101
+    public function addToList($pc) {
102
+        if($this->head == null) {
103
+            $this->head = $pc;
104
+            $this->tail = $this->head;
105
+        } else {
106
+            $this->tail->next = $pc;
107
+            $this->tail = $this->tail->next;
108
+        }
109
+    }
110 110
 
111
-	/**
112
-	 * @return string
113
-	 */
114
-	public function extractOption() {
115
-		if(($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
116
-			$end = strpos($this->pattern, '}' , $this->i);
117
-			if($end !== false) {
118
-				$r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
119
-				$this->i= $end + 1;
120
-				return $r;
121
-			}
122
-		}
123
-		return null;
124
-	}
111
+    /**
112
+     * @return string
113
+     */
114
+    public function extractOption() {
115
+        if(($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
116
+            $end = strpos($this->pattern, '}' , $this->i);
117
+            if($end !== false) {
118
+                $r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
119
+                $this->i= $end + 1;
120
+                return $r;
121
+            }
122
+        }
123
+        return null;
124
+    }
125 125
 
126
-	/**
127
-	 * The option is expected to be in decimal and positive. In case of
128
-	 * error, zero is returned.	 
129
-	 */
130
-	public function extractPrecisionOption() {
131
-		$opt = $this->extractOption();
132
-		$r = 0;
133
-		if($opt !== null) {
134
-			if(is_numeric($opt)) {
135
-				$r = (int)$opt;
136
-				if($r <= 0) {
137
-					$r = 0;
138
-				}
139
-			}
140
-		}
141
-		return $r;
142
-	}
126
+    /**
127
+     * The option is expected to be in decimal and positive. In case of
128
+     * error, zero is returned.	 
129
+     */
130
+    public function extractPrecisionOption() {
131
+        $opt = $this->extractOption();
132
+        $r = 0;
133
+        if($opt !== null) {
134
+            if(is_numeric($opt)) {
135
+                $r = (int)$opt;
136
+                if($r <= 0) {
137
+                    $r = 0;
138
+                }
139
+            }
140
+        }
141
+        return $r;
142
+    }
143 143
 
144 144
 	
145
-	/** Parser.
146
-	 * 
147
-	 * @return LoggerPatternConverter Returns $this->head.
148
-	 */
149
-	public function parse() {
150
-		$c = '';
151
-		$this->i = 0;
152
-		$this->currentLiteral = '';
153
-		while($this->i < $this->patternLength) {
154
-			$c = $this->pattern{$this->i++};
145
+    /** Parser.
146
+     * 
147
+     * @return LoggerPatternConverter Returns $this->head.
148
+     */
149
+    public function parse() {
150
+        $c = '';
151
+        $this->i = 0;
152
+        $this->currentLiteral = '';
153
+        while($this->i < $this->patternLength) {
154
+            $c = $this->pattern{$this->i++};
155 155
 
156
-			switch($this->state) {
157
-				case self::LITERAL_STATE:
158
-					// In literal state, the last char is always a literal.
159
-					if($this->i == $this->patternLength) {
160
-						$this->currentLiteral .= $c;
161
-						continue;
162
-					}
163
-					if($c == self::ESCAPE_CHAR) {
164
-						// peek at the next char.
165
-						switch($this->pattern{$this->i}) {
166
-							case self::ESCAPE_CHAR:
167
-								$this->currentLiteral .= $c;
168
-								$this->i++; // move pointer
169
-								break;
170
-							case 'n':
171
-								$this->currentLiteral .= PHP_EOL;
172
-								$this->i++; // move pointer
173
-								break;
174
-							default:
175
-								if(strlen($this->currentLiteral) != 0) {
176
-									$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
177
-								}
178
-								$this->currentLiteral = $c;
179
-								$this->state = self::CONVERTER_STATE;
180
-								$this->formattingInfo->reset();
181
-						}
182
-					} else {
183
-						$this->currentLiteral .= $c;
184
-					}
185
-					break;
186
-				case self::CONVERTER_STATE:
187
-						$this->currentLiteral .= $c;
188
-						switch($c) {
189
-						case '-':
190
-							$this->formattingInfo->leftAlign = true;
191
-							break;
192
-						case '.':
193
-							$this->state = self::DOT_STATE;
194
-								break;
195
-						default:
196
-							if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
197
-								$this->formattingInfo->min = ord($c) - ord('0');
198
-								$this->state = self::MIN_STATE;
199
-							} else {
200
-								$this->finalizeConverter($c);
201
-							}
202
-						} // switch
203
-					break;
204
-				case self::MIN_STATE:
205
-					$this->currentLiteral .= $c;
206
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
207
-						$this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord($c) - ord('0'));
208
-					} else if ($c == '.') {
209
-						$this->state = self::DOT_STATE;
210
-					} else {
211
-						$this->finalizeConverter($c);
212
-					}
213
-					break;
214
-				case self::DOT_STATE:
215
-					$this->currentLiteral .= $c;
216
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
217
-						$this->formattingInfo->max = ord($c) - ord('0');
218
-						$this->state = self::MAX_STATE;
219
-					} else {
220
-						$this->state = self::LITERAL_STATE;
221
-					}
222
-					break;
223
-				case self::MAX_STATE:
224
-					$this->currentLiteral .= $c;
225
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
226
-						$this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
227
-					} else {
228
-						$this->finalizeConverter($c);
229
-						$this->state = self::LITERAL_STATE;
230
-					}
231
-					break;
232
-			} // switch
233
-		} // while
234
-		if(strlen($this->currentLiteral) != 0) {
235
-			$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
236
-		}
237
-		return $this->head;
238
-	}
156
+            switch($this->state) {
157
+                case self::LITERAL_STATE:
158
+                    // In literal state, the last char is always a literal.
159
+                    if($this->i == $this->patternLength) {
160
+                        $this->currentLiteral .= $c;
161
+                        continue;
162
+                    }
163
+                    if($c == self::ESCAPE_CHAR) {
164
+                        // peek at the next char.
165
+                        switch($this->pattern{$this->i}) {
166
+                            case self::ESCAPE_CHAR:
167
+                                $this->currentLiteral .= $c;
168
+                                $this->i++; // move pointer
169
+                                break;
170
+                            case 'n':
171
+                                $this->currentLiteral .= PHP_EOL;
172
+                                $this->i++; // move pointer
173
+                                break;
174
+                            default:
175
+                                if(strlen($this->currentLiteral) != 0) {
176
+                                    $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
177
+                                }
178
+                                $this->currentLiteral = $c;
179
+                                $this->state = self::CONVERTER_STATE;
180
+                                $this->formattingInfo->reset();
181
+                        }
182
+                    } else {
183
+                        $this->currentLiteral .= $c;
184
+                    }
185
+                    break;
186
+                case self::CONVERTER_STATE:
187
+                        $this->currentLiteral .= $c;
188
+                        switch($c) {
189
+                        case '-':
190
+                            $this->formattingInfo->leftAlign = true;
191
+                            break;
192
+                        case '.':
193
+                            $this->state = self::DOT_STATE;
194
+                                break;
195
+                        default:
196
+                            if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
197
+                                $this->formattingInfo->min = ord($c) - ord('0');
198
+                                $this->state = self::MIN_STATE;
199
+                            } else {
200
+                                $this->finalizeConverter($c);
201
+                            }
202
+                        } // switch
203
+                    break;
204
+                case self::MIN_STATE:
205
+                    $this->currentLiteral .= $c;
206
+                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
207
+                        $this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord($c) - ord('0'));
208
+                    } else if ($c == '.') {
209
+                        $this->state = self::DOT_STATE;
210
+                    } else {
211
+                        $this->finalizeConverter($c);
212
+                    }
213
+                    break;
214
+                case self::DOT_STATE:
215
+                    $this->currentLiteral .= $c;
216
+                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
217
+                        $this->formattingInfo->max = ord($c) - ord('0');
218
+                        $this->state = self::MAX_STATE;
219
+                    } else {
220
+                        $this->state = self::LITERAL_STATE;
221
+                    }
222
+                    break;
223
+                case self::MAX_STATE:
224
+                    $this->currentLiteral .= $c;
225
+                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
226
+                        $this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
227
+                    } else {
228
+                        $this->finalizeConverter($c);
229
+                        $this->state = self::LITERAL_STATE;
230
+                    }
231
+                    break;
232
+            } // switch
233
+        } // while
234
+        if(strlen($this->currentLiteral) != 0) {
235
+            $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
236
+        }
237
+        return $this->head;
238
+    }
239 239
 
240
-	public function finalizeConverter($c) {
241
-		$pc = null;
242
-		switch($c) {
243
-			case 'c':
244
-				$pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
245
-				$this->currentLiteral = '';
246
-				break;
247
-			case 'C':
248
-				$pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
249
-				$this->currentLiteral = '';
250
-				break;
251
-			case 'd':
252
-				$dateFormatStr = self::DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
253
-				$dOpt = $this->extractOption();
240
+    public function finalizeConverter($c) {
241
+        $pc = null;
242
+        switch($c) {
243
+            case 'c':
244
+                $pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
245
+                $this->currentLiteral = '';
246
+                break;
247
+            case 'C':
248
+                $pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
249
+                $this->currentLiteral = '';
250
+                break;
251
+            case 'd':
252
+                $dateFormatStr = self::DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
253
+                $dOpt = $this->extractOption();
254 254
 
255
-				if($dOpt !== null)
256
-					$dateFormatStr = $dOpt;
255
+                if($dOpt !== null)
256
+                    $dateFormatStr = $dOpt;
257 257
 					
258
-				if($dateFormatStr == 'ISO8601') {
259
-					$df = self::DATE_FORMAT_ISO8601;
260
-				} else if($dateFormatStr == 'ABSOLUTE') {
261
-					$df = self::DATE_FORMAT_ABSOLUTE;
262
-				} else if($dateFormatStr == 'DATE') {
263
-					$df = self::DATE_FORMAT_DATE;
264
-				} else {
265
-					$df = $dateFormatStr;
266
-					if($df == null) {
267
-						$df = self::DATE_FORMAT_ISO8601;
268
-					}
269
-				}
270
-				$pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
271
-				$this->currentLiteral = '';
272
-				break;
273
-			case 'F':
274
-				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FILE_LOCATION_CONVERTER);
275
-				$this->currentLiteral = '';
276
-				break;
277
-			case 'l':
278
-				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FULL_LOCATION_CONVERTER);
279
-				$this->currentLiteral = '';
280
-				break;
281
-			case 'L':
282
-				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::LINE_LOCATION_CONVERTER);
283
-				$this->currentLiteral = '';
284
-				break;
285
-			case 'm':
286
-				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::MESSAGE_CONVERTER);
287
-				$this->currentLiteral = '';
288
-				break;
289
-			case 'M':
290
-				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::METHOD_LOCATION_CONVERTER);
291
-				$this->currentLiteral = '';
292
-				break;
293
-			case 'p':
294
-				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::LEVEL_CONVERTER);
295
-				$this->currentLiteral = '';
296
-				break;
297
-			case 'r':
298
-				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::RELATIVE_TIME_CONVERTER);
299
-				$this->currentLiteral = '';
300
-				break;
301
-			case 't':
302
-				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::THREAD_CONVERTER);
303
-				$this->currentLiteral = '';
304
-				break;
305
-			case 'u':
306
-				if($this->i < $this->patternLength) {
307
-					$cNext = $this->pattern{$this->i};
308
-					if(ord($cNext) >= ord('0') and ord($cNext) <= ord('9')) {
309
-						$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
310
-						$this->currentLiteral = '';
311
-						$this->i++;
312
-					}
313
-				}
314
-				break;
315
-			case 'x':
316
-				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::NDC_CONVERTER);
317
-				$this->currentLiteral = '';
318
-				break;
319
-			case 'X':
320
-				$xOpt = $this->extractOption();
321
-				$pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
322
-				$this->currentLiteral = '';
323
-				break;
324
-			default:
325
-				$pc = new LoggerLiteralPatternConverter($this->currentLiteral);
326
-				$this->currentLiteral = '';
327
-		}
328
-		$this->addConverter($pc);
329
-	}
258
+                if($dateFormatStr == 'ISO8601') {
259
+                    $df = self::DATE_FORMAT_ISO8601;
260
+                } else if($dateFormatStr == 'ABSOLUTE') {
261
+                    $df = self::DATE_FORMAT_ABSOLUTE;
262
+                } else if($dateFormatStr == 'DATE') {
263
+                    $df = self::DATE_FORMAT_DATE;
264
+                } else {
265
+                    $df = $dateFormatStr;
266
+                    if($df == null) {
267
+                        $df = self::DATE_FORMAT_ISO8601;
268
+                    }
269
+                }
270
+                $pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
271
+                $this->currentLiteral = '';
272
+                break;
273
+            case 'F':
274
+                $pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FILE_LOCATION_CONVERTER);
275
+                $this->currentLiteral = '';
276
+                break;
277
+            case 'l':
278
+                $pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FULL_LOCATION_CONVERTER);
279
+                $this->currentLiteral = '';
280
+                break;
281
+            case 'L':
282
+                $pc = new LoggerLocationPatternConverter($this->formattingInfo, self::LINE_LOCATION_CONVERTER);
283
+                $this->currentLiteral = '';
284
+                break;
285
+            case 'm':
286
+                $pc = new LoggerBasicPatternConverter($this->formattingInfo, self::MESSAGE_CONVERTER);
287
+                $this->currentLiteral = '';
288
+                break;
289
+            case 'M':
290
+                $pc = new LoggerLocationPatternConverter($this->formattingInfo, self::METHOD_LOCATION_CONVERTER);
291
+                $this->currentLiteral = '';
292
+                break;
293
+            case 'p':
294
+                $pc = new LoggerBasicPatternConverter($this->formattingInfo, self::LEVEL_CONVERTER);
295
+                $this->currentLiteral = '';
296
+                break;
297
+            case 'r':
298
+                $pc = new LoggerBasicPatternConverter($this->formattingInfo, self::RELATIVE_TIME_CONVERTER);
299
+                $this->currentLiteral = '';
300
+                break;
301
+            case 't':
302
+                $pc = new LoggerBasicPatternConverter($this->formattingInfo, self::THREAD_CONVERTER);
303
+                $this->currentLiteral = '';
304
+                break;
305
+            case 'u':
306
+                if($this->i < $this->patternLength) {
307
+                    $cNext = $this->pattern{$this->i};
308
+                    if(ord($cNext) >= ord('0') and ord($cNext) <= ord('9')) {
309
+                        $pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
310
+                        $this->currentLiteral = '';
311
+                        $this->i++;
312
+                    }
313
+                }
314
+                break;
315
+            case 'x':
316
+                $pc = new LoggerBasicPatternConverter($this->formattingInfo, self::NDC_CONVERTER);
317
+                $this->currentLiteral = '';
318
+                break;
319
+            case 'X':
320
+                $xOpt = $this->extractOption();
321
+                $pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
322
+                $this->currentLiteral = '';
323
+                break;
324
+            default:
325
+                $pc = new LoggerLiteralPatternConverter($this->currentLiteral);
326
+                $this->currentLiteral = '';
327
+        }
328
+        $this->addConverter($pc);
329
+    }
330 330
 
331
-	public function addConverter($pc) {
332
-		$this->currentLiteral = '';
333
-		// Add the pattern converter to the list.
334
-		$this->addToList($pc);
335
-		// Next pattern is assumed to be a literal.
336
-		$this->state = self::LITERAL_STATE;
337
-		// Reset formatting info
338
-		$this->formattingInfo->reset();
339
-	}
331
+    public function addConverter($pc) {
332
+        $this->currentLiteral = '';
333
+        // Add the pattern converter to the list.
334
+        $this->addToList($pc);
335
+        // Next pattern is assumed to be a literal.
336
+        $this->state = self::LITERAL_STATE;
337
+        // Reset formatting info
338
+        $this->formattingInfo->reset();
339
+    }
340 340
 }
341 341
 
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -186,19 +186,19 @@
 block discarded – undo
186 186
 				case self::CONVERTER_STATE:
187 187
 						$this->currentLiteral .= $c;
188 188
 						switch($c) {
189
-						case '-':
190
-							$this->formattingInfo->leftAlign = true;
191
-							break;
192
-						case '.':
193
-							$this->state = self::DOT_STATE;
194
-								break;
195
-						default:
196
-							if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
197
-								$this->formattingInfo->min = ord($c) - ord('0');
198
-								$this->state = self::MIN_STATE;
199
-							} else {
200
-								$this->finalizeConverter($c);
201
-							}
189
+						    case '-':
190
+							    $this->formattingInfo->leftAlign = true;
191
+							    break;
192
+						    case '.':
193
+							    $this->state = self::DOT_STATE;
194
+								    break;
195
+						    default:
196
+							    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
197
+								    $this->formattingInfo->min = ord($c) - ord('0');
198
+								    $this->state = self::MIN_STATE;
199
+							    } else {
200
+								    $this->finalizeConverter($c);
201
+							    }
202 202
 						} // switch
203 203
 					break;
204 204
 				case self::MIN_STATE:
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function __construct($pattern) {
92 92
 		$this->pattern = $pattern;
93
-		$this->patternLength =	strlen($pattern);
93
+		$this->patternLength = strlen($pattern);
94 94
 		$this->formattingInfo = new LoggerFormattingInfo();
95 95
 		$this->state = self::LITERAL_STATE;
96 96
 	}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param LoggerPatternConverter $pc
100 100
 	 */
101 101
 	public function addToList($pc) {
102
-		if($this->head == null) {
102
+		if ($this->head == null) {
103 103
 			$this->head = $pc;
104 104
 			$this->tail = $this->head;
105 105
 		} else {
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 	 * @return string
113 113
 	 */
114 114
 	public function extractOption() {
115
-		if(($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
116
-			$end = strpos($this->pattern, '}' , $this->i);
117
-			if($end !== false) {
115
+		if (($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
116
+			$end = strpos($this->pattern, '}', $this->i);
117
+			if ($end !== false) {
118 118
 				$r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
119
-				$this->i= $end + 1;
119
+				$this->i = $end + 1;
120 120
 				return $r;
121 121
 			}
122 122
 		}
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	public function extractPrecisionOption() {
131 131
 		$opt = $this->extractOption();
132 132
 		$r = 0;
133
-		if($opt !== null) {
134
-			if(is_numeric($opt)) {
135
-				$r = (int)$opt;
136
-				if($r <= 0) {
133
+		if ($opt !== null) {
134
+			if (is_numeric($opt)) {
135
+				$r = (int) $opt;
136
+				if ($r <= 0) {
137 137
 					$r = 0;
138 138
 				}
139 139
 			}
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 		$c = '';
151 151
 		$this->i = 0;
152 152
 		$this->currentLiteral = '';
153
-		while($this->i < $this->patternLength) {
153
+		while ($this->i < $this->patternLength) {
154 154
 			$c = $this->pattern{$this->i++};
155 155
 
156
-			switch($this->state) {
156
+			switch ($this->state) {
157 157
 				case self::LITERAL_STATE:
158 158
 					// In literal state, the last char is always a literal.
159
-					if($this->i == $this->patternLength) {
159
+					if ($this->i == $this->patternLength) {
160 160
 						$this->currentLiteral .= $c;
161 161
 						continue;
162 162
 					}
163
-					if($c == self::ESCAPE_CHAR) {
163
+					if ($c == self::ESCAPE_CHAR) {
164 164
 						// peek at the next char.
165
-						switch($this->pattern{$this->i}) {
165
+						switch ($this->pattern{$this->i}) {
166 166
 							case self::ESCAPE_CHAR:
167 167
 								$this->currentLiteral .= $c;
168 168
 								$this->i++; // move pointer
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 								$this->i++; // move pointer
173 173
 								break;
174 174
 							default:
175
-								if(strlen($this->currentLiteral) != 0) {
175
+								if (strlen($this->currentLiteral) != 0) {
176 176
 									$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
177 177
 								}
178 178
 								$this->currentLiteral = $c;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 					break;
186 186
 				case self::CONVERTER_STATE:
187 187
 						$this->currentLiteral .= $c;
188
-						switch($c) {
188
+						switch ($c) {
189 189
 						case '-':
190 190
 							$this->formattingInfo->leftAlign = true;
191 191
 							break;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 							$this->state = self::DOT_STATE;
194 194
 								break;
195 195
 						default:
196
-							if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
196
+							if (ord($c) >= ord('0') and ord($c) <= ord('9')) {
197 197
 								$this->formattingInfo->min = ord($c) - ord('0');
198 198
 								$this->state = self::MIN_STATE;
199 199
 							} else {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 					break;
204 204
 				case self::MIN_STATE:
205 205
 					$this->currentLiteral .= $c;
206
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
206
+					if (ord($c) >= ord('0') and ord($c) <= ord('9')) {
207 207
 						$this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord($c) - ord('0'));
208 208
 					} else if ($c == '.') {
209 209
 						$this->state = self::DOT_STATE;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 					break;
214 214
 				case self::DOT_STATE:
215 215
 					$this->currentLiteral .= $c;
216
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
216
+					if (ord($c) >= ord('0') and ord($c) <= ord('9')) {
217 217
 						$this->formattingInfo->max = ord($c) - ord('0');
218 218
 						$this->state = self::MAX_STATE;
219 219
 					} else {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 					break;
223 223
 				case self::MAX_STATE:
224 224
 					$this->currentLiteral .= $c;
225
-					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
225
+					if (ord($c) >= ord('0') and ord($c) <= ord('9')) {
226 226
 						$this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
227 227
 					} else {
228 228
 						$this->finalizeConverter($c);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 					break;
232 232
 			} // switch
233 233
 		} // while
234
-		if(strlen($this->currentLiteral) != 0) {
234
+		if (strlen($this->currentLiteral) != 0) {
235 235
 			$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
236 236
 		}
237 237
 		return $this->head;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 	public function finalizeConverter($c) {
241 241
 		$pc = null;
242
-		switch($c) {
242
+		switch ($c) {
243 243
 			case 'c':
244 244
 				$pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
245 245
 				$this->currentLiteral = '';
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
 				$dateFormatStr = self::DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
253 253
 				$dOpt = $this->extractOption();
254 254
 
255
-				if($dOpt !== null)
255
+				if ($dOpt !== null)
256 256
 					$dateFormatStr = $dOpt;
257 257
 					
258
-				if($dateFormatStr == 'ISO8601') {
258
+				if ($dateFormatStr == 'ISO8601') {
259 259
 					$df = self::DATE_FORMAT_ISO8601;
260
-				} else if($dateFormatStr == 'ABSOLUTE') {
260
+				} else if ($dateFormatStr == 'ABSOLUTE') {
261 261
 					$df = self::DATE_FORMAT_ABSOLUTE;
262
-				} else if($dateFormatStr == 'DATE') {
262
+				} else if ($dateFormatStr == 'DATE') {
263 263
 					$df = self::DATE_FORMAT_DATE;
264 264
 				} else {
265 265
 					$df = $dateFormatStr;
266
-					if($df == null) {
266
+					if ($df == null) {
267 267
 						$df = self::DATE_FORMAT_ISO8601;
268 268
 					}
269 269
 				}
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 				$this->currentLiteral = '';
304 304
 				break;
305 305
 			case 'u':
306
-				if($this->i < $this->patternLength) {
306
+				if ($this->i < $this->patternLength) {
307 307
 					$cNext = $this->pattern{$this->i};
308
-					if(ord($cNext) >= ord('0') and ord($cNext) <= ord('9')) {
309
-						$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
308
+					if (ord($cNext) >= ord('0') and ord($cNext) <= ord('9')) {
309
+						$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string) (ord($cNext) - ord('0')));
310 310
 						$this->currentLiteral = '';
311 311
 						$this->i++;
312 312
 					}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,8 +252,9 @@
 block discarded – undo
252 252
 				$dateFormatStr = self::DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
253 253
 				$dOpt = $this->extractOption();
254 254
 
255
-				if($dOpt !== null)
256
-					$dateFormatStr = $dOpt;
255
+				if($dOpt !== null) {
256
+									$dateFormatStr = $dOpt;
257
+				}
257 258
 					
258 259
 				if($dateFormatStr == 'ISO8601') {
259 260
 					$df = self::DATE_FORMAT_ISO8601;
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/layouts/LoggerLayoutPattern.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -169,6 +169,7 @@
 block discarded – undo
169 169
 	 * Set the <b>ConversionPattern</b> option. This is the string which
170 170
 	 * controls formatting and consists of a mix of literal content and
171 171
 	 * conversion specifiers.
172
+	 * @param string $conversionPattern
172 173
 	 */
173 174
 	public function setConversionPattern($conversionPattern) {
174 175
 		$this->pattern = $conversionPattern;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
         $results = array();
207 207
         $c = $this->head;
208 208
         while ($c !== null) {
209
-            if ( ! $c instanceOf LoggerLiteralPatternConverter) {
209
+            if (!$c instanceOf LoggerLiteralPatternConverter) {
210 210
                 $sbuf = null;
211 211
                 $c->format($sbuf, $event);
212 212
                 $results[] = $sbuf;
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -136,61 +136,61 @@
 block discarded – undo
136 136
  * @since 0.3 
137 137
  */
138 138
 class LoggerLayoutPattern extends LoggerLayout {
139
-	/** Default conversion Pattern */
140
-	const DEFAULT_CONVERSION_PATTERN = '%m%n';
139
+    /** Default conversion Pattern */
140
+    const DEFAULT_CONVERSION_PATTERN = '%m%n';
141 141
 
142
-	/** Default conversion TTCC Pattern */
143
-	const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
142
+    /** Default conversion TTCC Pattern */
143
+    const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
144 144
 
145
-	/** The pattern. 
146
-	 * @var string */
147
-	private $pattern;
145
+    /** The pattern. 
146
+     * @var string */
147
+    private $pattern;
148 148
 
149
-	/** Head of a chain of Converters.
150
-	 * @var LoggerPatternConverter */
151
-	private $head;
149
+    /** Head of a chain of Converters.
150
+     * @var LoggerPatternConverter */
151
+    private $head;
152 152
 
153
-	private $timezone;
153
+    private $timezone;
154 154
 
155
-	/**
156
-	 * Constructs a PatternLayout using the 
157
-	 * {@link DEFAULT_LAYOUT_PATTERN}.
158
-	 * The default pattern just produces the application supplied message.
159
-	 */
160
-	public function __construct($pattern = null) {
161
-		if ($pattern === null) {
162
-			$this->pattern = self :: DEFAULT_CONVERSION_PATTERN;
163
-		} else {
164
-			$this->pattern = $pattern;
165
-		}
166
-	}
155
+    /**
156
+     * Constructs a PatternLayout using the 
157
+     * {@link DEFAULT_LAYOUT_PATTERN}.
158
+     * The default pattern just produces the application supplied message.
159
+     */
160
+    public function __construct($pattern = null) {
161
+        if ($pattern === null) {
162
+            $this->pattern = self :: DEFAULT_CONVERSION_PATTERN;
163
+        } else {
164
+            $this->pattern = $pattern;
165
+        }
166
+    }
167 167
 
168
-	/**
169
-	 * Set the <b>ConversionPattern</b> option. This is the string which
170
-	 * controls formatting and consists of a mix of literal content and
171
-	 * conversion specifiers.
172
-	 */
173
-	public function setConversionPattern($conversionPattern) {
174
-		$this->pattern = $conversionPattern;
175
-		$patternParser = new LoggerPatternParser($this->pattern);
176
-		$this->head = $patternParser->parse();
177
-	}
168
+    /**
169
+     * Set the <b>ConversionPattern</b> option. This is the string which
170
+     * controls formatting and consists of a mix of literal content and
171
+     * conversion specifiers.
172
+     */
173
+    public function setConversionPattern($conversionPattern) {
174
+        $this->pattern = $conversionPattern;
175
+        $patternParser = new LoggerPatternParser($this->pattern);
176
+        $this->head = $patternParser->parse();
177
+    }
178 178
 
179
-	/**
180
-	 * Produces a formatted string as specified by the conversion pattern.
181
-	 *
182
-	 * @param LoggerLoggingEvent $event
183
-	 * @return string
184
-	 */
185
-	public function format(LoggerLoggingEvent $event) {
186
-		$sbuf = '';
187
-		$c = $this->head;
188
-		while ($c !== null) {
189
-			$c->format($sbuf, $event);
190
-			$c = $c->next;
191
-		}
192
-		return $sbuf;
193
-	}
179
+    /**
180
+     * Produces a formatted string as specified by the conversion pattern.
181
+     *
182
+     * @param LoggerLoggingEvent $event
183
+     * @return string
184
+     */
185
+    public function format(LoggerLoggingEvent $event) {
186
+        $sbuf = '';
187
+        $c = $this->head;
188
+        while ($c !== null) {
189
+            $c->format($sbuf, $event);
190
+            $c = $c->next;
191
+        }
192
+        return $sbuf;
193
+    }
194 194
 	
195 195
     /**
196 196
      * Returns an array with the formatted elements.
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/Logger.php 4 patches
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	/**
241 241
 	 * Log a message object with the ERROR level including the caller.
242 242
 	 *
243
-	 * @param mixed $message message
243
+	 * @param string $message message
244 244
 	 * @param mixed $caller caller object or caller string id
245 245
 	 */
246 246
 	public function error($message, $caller = null) {
@@ -286,6 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * Check whether this category is enabled for a given Level passed as parameter.
287 287
 	 *
288 288
 	 * @param LoggerLevel level
289
+	 * @param LoggerLevel $level
289 290
 	 * @return boolean
290 291
 	 */
291 292
 	public function isEnabledFor($level) {
@@ -326,6 +327,9 @@  discard block
 block discarded – undo
326 327
 		}
327 328
 	}
328 329
 	 
330
+	/**
331
+	 * @param LoggerLevel $level
332
+	 */
329 333
 	private function logLevel($message, $level, $caller = null) {
330 334
 		if($level->isGreaterOrEqual($this->getEffectiveLevel())) {
331 335
 			$this->forcedLog($this->fqcn, $caller, $level, $message);
@@ -338,7 +342,6 @@  discard block
 block discarded – undo
338 342
 	 * Get a Logger by name (Delegate to {@link Logger})
339 343
 	 * 
340 344
 	 * @param string $name logger name
341
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
342 345
 	 * @return Logger
343 346
 	 * @static 
344 347
 	 */
@@ -474,7 +477,7 @@  discard block
 block discarded – undo
474 477
 	 * Clears all logger definitions
475 478
 	 * 
476 479
 	 * @static
477
-	 * @return boolean 
480
+	 * @return boolean|null 
478 481
 	 */
479 482
 	public static function clear() {
480 483
 		return self::getHierarchy()->clear();	 
@@ -484,7 +487,7 @@  discard block
 block discarded – undo
484 487
 	 * Destroy configurations for logger definitions
485 488
 	 * 
486 489
 	 * @static
487
-	 * @return boolean 
490
+	 * @return boolean|null 
488 491
 	 */
489 492
 	public static function resetConfiguration() {
490 493
 		$result = self::getHierarchy()->resetConfiguration();
@@ -592,7 +595,7 @@  discard block
 block discarded – undo
592 595
 	
593 596
 	/**
594 597
 	 * Returns the current configurator
595
-	 * @return the configurator
598
+	 * @return string configurator
596 599
 	 */
597 600
 	public static function getConfigurationClass() {
598 601
 		return self::$configurationClass;
@@ -600,7 +603,7 @@  discard block
 block discarded – undo
600 603
 	
601 604
 	/**
602 605
 	 * Returns the current configuration file
603
-	 * @return the configuration file
606
+	 * @return null|string configuration file
604 607
 	 */
605 608
 	public static function getConfigurationFile() {
606 609
 		return self::$configurationFile;
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @param string class name
124 124
 	 */
125 125
 	public static function autoload($className) {
126
-		if(isset(self::$_classes[$className])) {
126
+		if (isset(self::$_classes[$className])) {
127 127
 			include LOG4PHP_DIR.self::$_classes[$className];
128 128
 		}
129 129
 	}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @return LoggerHierarchy
200 200
 	 */
201 201
 	public static function getHierarchy() {
202
-		if(!isset(self::$hierarchy)) {
202
+		if (!isset(self::$hierarchy)) {
203 203
 			self::$hierarchy = new LoggerHierarchy(new LoggerRoot());
204 204
 		}
205 205
 		return self::$hierarchy;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return boolean
290 290
 	 */
291 291
 	public function isEnabledFor($level) {
292
-		return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
292
+		return (bool) ($level->isGreaterOrEqual($this->getEffectiveLevel()));
293 293
 	} 
294 294
 
295 295
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param mixed $caller caller object or caller string id
310 310
 	 */
311 311
 	public function log($priority, $message, $caller = null) {
312
-		if($this->isEnabledFor($priority)) {
312
+		if ($this->isEnabledFor($priority)) {
313 313
 			$this->forcedLog($this->fqcn, $caller, $priority, $message);
314 314
 		}
315 315
 	}
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 	 * @param string $msg message to log
322 322
 	 */
323 323
 	public function assertLog($assertion = true, $msg = '') {
324
-		if($assertion == false) {
324
+		if ($assertion == false) {
325 325
 			$this->error($msg);
326 326
 		}
327 327
 	}
328 328
 	 
329 329
 	private function logLevel($message, $level, $caller = null) {
330
-		if($level->isGreaterOrEqual($this->getEffectiveLevel())) {
330
+		if ($level->isGreaterOrEqual($this->getEffectiveLevel())) {
331 331
 			$this->forcedLog($this->fqcn, $caller, $level, $message);
332 332
 		}
333 333
 	} 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 * @static 
344 344
 	 */
345 345
 	public static function getLogger($name) {
346
-		if(!self::isInitialized()) {
346
+		if (!self::isInitialized()) {
347 347
 			self::initialize();
348 348
 		}
349 349
 		return self::getHierarchy()->getLogger($name);
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @static 
356 356
 	 */	   
357 357
 	public static function getRootLogger() {
358
-		if(!self::isInitialized()) {
358
+		if (!self::isInitialized()) {
359 359
 			self::initialize();
360 360
 		}
361 361
 		return self::getHierarchy()->getRootLogger();	  
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	public function removeAllAppenders() {
380 380
 		$appenderNames = array_keys($this->aai);
381 381
 		$enumAppenders = count($appenderNames);
382
-		for($i = 0; $i < $enumAppenders; $i++) {
382
+		for ($i = 0; $i < $enumAppenders; $i++) {
383 383
 			$this->removeAppender($appenderNames[$i]); 
384 384
 		}
385 385
 	} 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
391 391
 	 */
392 392
 	public function removeAppender($appender) {
393
-		if($appender instanceof LoggerAppender) {
393
+		if ($appender instanceof LoggerAppender) {
394 394
 			$appender->close();
395 395
 			unset($this->aai[$appender->getName()]);
396 396
 		} else if (is_string($appender) and isset($this->aai[$appender])) {
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
 	 * @param LoggerLoggingEvent $event 
406 406
 	 */
407 407
 	public function callAppenders($event) {
408
-		if(count($this->aai) > 0) {
409
-			foreach(array_keys($this->aai) as $appenderName) {
408
+		if (count($this->aai) > 0) {
409
+			foreach (array_keys($this->aai) as $appenderName) {
410 410
 				$this->aai[$appenderName]->doAppend($event);
411 411
 			}
412 412
 		}
413
-		if($this->parent != null and $this->getAdditivity()) {
413
+		if ($this->parent != null and $this->getAdditivity()) {
414 414
 			$this->parent->callAppenders($event);
415 415
 		}
416 416
 	}
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	 * @return LoggerLevel or null
446 446
 	 */
447 447
 	public function getEffectiveLevel() {
448
-		for($c = $this; $c != null; $c = $c->parent) {
449
-			if($c->getLevel() !== null) {
448
+		for ($c = $this; $c != null; $c = $c->parent) {
449
+			if ($c->getLevel() !== null) {
450 450
 				return $c->getLevel();
451 451
 			}
452 452
 		}
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 	 * @param boolean $additive
543 543
 	 */
544 544
 	public function setAdditivity($additive) {
545
-		$this->additive = (bool)$additive;
545
+		$this->additive = (bool) $additive;
546 546
 	}
547 547
 
548 548
 	/**
@@ -569,19 +569,19 @@  discard block
 block discarded – undo
569 569
 	 * @param String $configurationClass the configurator class
570 570
 	 */
571 571
 	public static function configure($configurationFile = null, 
572
-									 $configurationClass = null ) {
573
-		if($configurationClass === null && $configurationFile === null) {
572
+									 $configurationClass = null) {
573
+		if ($configurationClass === null && $configurationFile === null) {
574 574
 			self::$configurationClass = 'LoggerConfiguratorBasic';
575 575
 			return;
576 576
 		}
577 577
 									 	
578
-		if($configurationClass !== null) {
578
+		if ($configurationClass !== null) {
579 579
 			self::$configurationFile = $configurationFile;
580 580
 			self::$configurationClass = $configurationClass;
581 581
 			return;
582 582
 		}
583 583
 		
584
-		if (strtolower(substr( $configurationFile, -4 )) == '.xml') {
584
+		if (strtolower(substr($configurationFile, -4)) == '.xml') {
585 585
 			self::$configurationFile = $configurationFile;
586 586
 			self::$configurationClass = 'LoggerConfiguratorXml';
587 587
 		} else {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
  * 
27 27
  * @var string 
28 28
  */
29
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
29
+if (!defined('LOG4PHP_DIR')) {
30
+    define('LOG4PHP_DIR', dirname(__FILE__));
31
+}
30 32
 
31 33
 spl_autoload_register(array('Logger', 'autoload'));
32 34
 
Please login to merge, or discard this patch.
Indentation   +566 added lines, -566 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- * 
10
- *		http://www.apache.org/licenses/LICENSE-2.0
11
- * 
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- * 
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     * 
10
+     *		http://www.apache.org/licenses/LICENSE-2.0
11
+     * 
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     * 
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * LOG4PHP_DIR points to the log4php root directory.
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @version	   SVN: $Id: Logger.php 824193 2009-10-11 22:51:24Z chammers $
44 44
  * @link	   http://logging.apache.org/log4php
45 45
  */
46
- /*
46
+    /*
47 47
   * TODO:
48 48
   * Localization: setResourceBundle($bundle) : not supported
49 49
   * Localization: getResourceBundle: not supported
@@ -51,576 +51,576 @@  discard block
 block discarded – undo
51 51
   * Localization: l7dlog($priority, $key, $params, $t) : not supported
52 52
   */
53 53
 class Logger {
54
-	private static $_classes = array(
55
-		'LoggerException' => '/LoggerException.php',
56
-		'LoggerHierarchy' => '/LoggerHierarchy.php',
57
-		'LoggerLayout' => '/LoggerLayout.php',
58
-		'LoggerLevel' => '/LoggerLevel.php',
59
-		'LoggerMDC' => '/LoggerMDC.php',
60
-		'LoggerNDC' => '/LoggerNDC.php',
61
-		'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
62
-		'LoggerConfigurator' => '/LoggerConfigurator.php',
63
-		'LoggerConfiguratorBasic' => '/configurators/LoggerConfiguratorBasic.php',
64
-		'LoggerConfiguratorIni' => '/configurators/LoggerConfiguratorIni.php',
65
-		'LoggerConfiguratorPhp' => '/configurators/LoggerConfiguratorPhp.php',
66
-		'LoggerConfiguratorXml' => '/configurators/LoggerConfiguratorXml.php',
67
-		'LoggerRoot' => '/LoggerRoot.php',
68
-		'LoggerAppender' => '/LoggerAppender.php',
69
-		'LoggerAppenderPool' => '/LoggerAppenderPool.php',
70
-		'LoggerAppenderAdodb' => '/appenders/LoggerAppenderAdodb.php',
71
-		'LoggerAppenderPDO' => '/appenders/LoggerAppenderPDO.php',
72
-		'LoggerAppenderConsole' => '/appenders/LoggerAppenderConsole.php',
73
-		'LoggerAppenderDailyFile' => '/appenders/LoggerAppenderDailyFile.php',
74
-		'LoggerAppenderEcho' => '/appenders/LoggerAppenderEcho.php',
75
-		'LoggerAppenderFile' => '/appenders/LoggerAppenderFile.php',
76
-		'LoggerAppenderMail' => '/appenders/LoggerAppenderMail.php',
77
-		'LoggerAppenderMailEvent' => '/appenders/LoggerAppenderMailEvent.php',
78
-		'LoggerAppenderNull' => '/appenders/LoggerAppenderNull.php',
79
-		'LoggerAppenderPhp' => '/appenders/LoggerAppenderPhp.php',
80
-		'LoggerAppenderRollingFile' => '/appenders/LoggerAppenderRollingFile.php',
81
-		'LoggerAppenderSocket' => '/appenders/LoggerAppenderSocket.php',
82
-		'LoggerAppenderSyslog' => '/appenders/LoggerAppenderSyslog.php',
83
-		'LoggerFormattingInfo' => '/helpers/LoggerFormattingInfo.php',
84
-		'LoggerOptionConverter' => '/helpers/LoggerOptionConverter.php',
85
-		'LoggerPatternConverter' => '/helpers/LoggerPatternConverter.php',
86
-		'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
87
-		'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
88
-		'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
89
-		'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
90
-		'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
91
-		'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
92
-		'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
93
-		'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
94
-		'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
95
-		'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
96
-		'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
97
-		'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
98
-		'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
99
-		'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
100
-		'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
101
-		'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
102
-		'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
103
-		'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
104
-		'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
105
-		'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
106
-		'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
107
-		'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
108
-		'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
109
-		'LoggerRendererObject' => '/renderers/LoggerRendererObject.php',
110
-		'LoggerRendererMap' => '/renderers/LoggerRendererMap.php',
111
-		'LoggerLocationInfo' => '/LoggerLocationInfo.php',
112
-		'LoggerLoggingEvent' => '/LoggerLoggingEvent.php',
113
-		'LoggerFilter' => '/LoggerFilter.php',
114
-		'LoggerFilterDenyAll' => '/filters/LoggerFilterDenyAll.php',
115
-		'LoggerFilterLevelMatch' => '/filters/LoggerFilterLevelMatch.php',
116
-		'LoggerFilterLevelRange' => '/filters/LoggerFilterLevelRange.php',
117
-		'LoggerFilterStringMatch' => '/filters/LoggerFilterStringMatch.php',
118
-	);
54
+    private static $_classes = array(
55
+        'LoggerException' => '/LoggerException.php',
56
+        'LoggerHierarchy' => '/LoggerHierarchy.php',
57
+        'LoggerLayout' => '/LoggerLayout.php',
58
+        'LoggerLevel' => '/LoggerLevel.php',
59
+        'LoggerMDC' => '/LoggerMDC.php',
60
+        'LoggerNDC' => '/LoggerNDC.php',
61
+        'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
62
+        'LoggerConfigurator' => '/LoggerConfigurator.php',
63
+        'LoggerConfiguratorBasic' => '/configurators/LoggerConfiguratorBasic.php',
64
+        'LoggerConfiguratorIni' => '/configurators/LoggerConfiguratorIni.php',
65
+        'LoggerConfiguratorPhp' => '/configurators/LoggerConfiguratorPhp.php',
66
+        'LoggerConfiguratorXml' => '/configurators/LoggerConfiguratorXml.php',
67
+        'LoggerRoot' => '/LoggerRoot.php',
68
+        'LoggerAppender' => '/LoggerAppender.php',
69
+        'LoggerAppenderPool' => '/LoggerAppenderPool.php',
70
+        'LoggerAppenderAdodb' => '/appenders/LoggerAppenderAdodb.php',
71
+        'LoggerAppenderPDO' => '/appenders/LoggerAppenderPDO.php',
72
+        'LoggerAppenderConsole' => '/appenders/LoggerAppenderConsole.php',
73
+        'LoggerAppenderDailyFile' => '/appenders/LoggerAppenderDailyFile.php',
74
+        'LoggerAppenderEcho' => '/appenders/LoggerAppenderEcho.php',
75
+        'LoggerAppenderFile' => '/appenders/LoggerAppenderFile.php',
76
+        'LoggerAppenderMail' => '/appenders/LoggerAppenderMail.php',
77
+        'LoggerAppenderMailEvent' => '/appenders/LoggerAppenderMailEvent.php',
78
+        'LoggerAppenderNull' => '/appenders/LoggerAppenderNull.php',
79
+        'LoggerAppenderPhp' => '/appenders/LoggerAppenderPhp.php',
80
+        'LoggerAppenderRollingFile' => '/appenders/LoggerAppenderRollingFile.php',
81
+        'LoggerAppenderSocket' => '/appenders/LoggerAppenderSocket.php',
82
+        'LoggerAppenderSyslog' => '/appenders/LoggerAppenderSyslog.php',
83
+        'LoggerFormattingInfo' => '/helpers/LoggerFormattingInfo.php',
84
+        'LoggerOptionConverter' => '/helpers/LoggerOptionConverter.php',
85
+        'LoggerPatternConverter' => '/helpers/LoggerPatternConverter.php',
86
+        'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
87
+        'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
88
+        'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
89
+        'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
90
+        'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
91
+        'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
92
+        'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
93
+        'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
94
+        'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
95
+        'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
96
+        'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
97
+        'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
98
+        'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
99
+        'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
100
+        'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
101
+        'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
102
+        'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
103
+        'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
104
+        'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
105
+        'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
106
+        'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
107
+        'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
108
+        'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
109
+        'LoggerRendererObject' => '/renderers/LoggerRendererObject.php',
110
+        'LoggerRendererMap' => '/renderers/LoggerRendererMap.php',
111
+        'LoggerLocationInfo' => '/LoggerLocationInfo.php',
112
+        'LoggerLoggingEvent' => '/LoggerLoggingEvent.php',
113
+        'LoggerFilter' => '/LoggerFilter.php',
114
+        'LoggerFilterDenyAll' => '/filters/LoggerFilterDenyAll.php',
115
+        'LoggerFilterLevelMatch' => '/filters/LoggerFilterLevelMatch.php',
116
+        'LoggerFilterLevelRange' => '/filters/LoggerFilterLevelRange.php',
117
+        'LoggerFilterStringMatch' => '/filters/LoggerFilterStringMatch.php',
118
+    );
119 119
 
120
-	/**
121
-	 * Class autoloader
122
-	 * This method is provided to be invoked within an __autoload() magic method.
123
-	 * @param string class name
124
-	 */
125
-	public static function autoload($className) {
126
-		if(isset(self::$_classes[$className])) {
127
-			include LOG4PHP_DIR.self::$_classes[$className];
128
-		}
129
-	}
120
+    /**
121
+     * Class autoloader
122
+     * This method is provided to be invoked within an __autoload() magic method.
123
+     * @param string class name
124
+     */
125
+    public static function autoload($className) {
126
+        if(isset(self::$_classes[$className])) {
127
+            include LOG4PHP_DIR.self::$_classes[$className];
128
+        }
129
+    }
130 130
 
131
-	/**
132
-	 * Additivity is set to true by default, that is children inherit the 
133
-	 * appenders of their ancestors by default.
134
-	 * @var boolean
135
-	 */
136
-	private $additive = true;
137
-	
138
-	/** @var string fully qualified class name */
139
-	private $fqcn = 'Logger';
131
+    /**
132
+     * Additivity is set to true by default, that is children inherit the 
133
+     * appenders of their ancestors by default.
134
+     * @var boolean
135
+     */
136
+    private $additive = true;
137
+	
138
+    /** @var string fully qualified class name */
139
+    private $fqcn = 'Logger';
140 140
 
141
-	/** @var LoggerLevel The assigned level of this category. */
142
-	private $level = null;
141
+    /** @var LoggerLevel The assigned level of this category. */
142
+    private $level = null;
143 143
 	
144
-	/** @var string name of this category. */
145
-	private $name = '';
144
+    /** @var string name of this category. */
145
+    private $name = '';
146 146
 	
147
-	/** @var Logger The parent of this category. Null if this is the root logger*/
148
-	private $parent = null;
147
+    /** @var Logger The parent of this category. Null if this is the root logger*/
148
+    private $parent = null;
149 149
 	
150
-	/**
151
-	 * @var array collection of appenders
152
-	 * @see LoggerAppender
153
-	 */
154
-	private $aai = array();
150
+    /**
151
+     * @var array collection of appenders
152
+     * @see LoggerAppender
153
+     */
154
+    private $aai = array();
155 155
 
156
-	/** the hierarchy used by log4php */
157
-	private static $hierarchy;
158
-	
159
-	/** the configurator class name */
160
-	private static $configurationClass = 'LoggerConfiguratorBasic';
161
-	
162
-	/** the path to the configuration file */
163
-	private static $configurationFile = null;
164
-	
165
-	/** inidicates if log4php has already been initialized */
166
-	private static $initialized = false;
167
-	
168
-	/**
169
-	 * Constructor.
170
-	 * @param  string  $name  Category name	  
171
-	 */
172
-	public function __construct($name) {
173
-		$this->name = $name;
174
-	}
175
-	
176
-	/**
177
-	 * Return the category name.
178
-	 * @return string
179
-	 */
180
-	public function getName() {
181
-		return $this->name;
182
-	} 
156
+    /** the hierarchy used by log4php */
157
+    private static $hierarchy;
158
+	
159
+    /** the configurator class name */
160
+    private static $configurationClass = 'LoggerConfiguratorBasic';
161
+	
162
+    /** the path to the configuration file */
163
+    private static $configurationFile = null;
164
+	
165
+    /** inidicates if log4php has already been initialized */
166
+    private static $initialized = false;
167
+	
168
+    /**
169
+     * Constructor.
170
+     * @param  string  $name  Category name	  
171
+     */
172
+    public function __construct($name) {
173
+        $this->name = $name;
174
+    }
175
+	
176
+    /**
177
+     * Return the category name.
178
+     * @return string
179
+     */
180
+    public function getName() {
181
+        return $this->name;
182
+    } 
183 183
 
184
-	/**
185
-	 * Returns the parent of this category.
186
-	 * @return Logger
187
-	 */
188
-	public function getParent() {
189
-		return $this->parent;
190
-	}	  
191
-	
192
-	/**
193
-	 * Returns the hierarchy used by this Logger.
194
-	 * Caution: do not use this hierarchy unless you have called initialize().
195
-	 * To get Loggers, use the Logger::getLogger and Logger::getRootLogger methods
196
-	 * instead of operating on on the hierarchy directly.
197
-	 * 
198
-	 * @deprecated - will be moved to private
199
-	 * @return LoggerHierarchy
200
-	 */
201
-	public static function getHierarchy() {
202
-		if(!isset(self::$hierarchy)) {
203
-			self::$hierarchy = new LoggerHierarchy(new LoggerRoot());
204
-		}
205
-		return self::$hierarchy;
206
-	}
207
-	
208
-	/* Logging methods */
209
-	/**
210
-	 * Log a message object with the DEBUG level including the caller.
211
-	 *
212
-	 * @param mixed $message message
213
-	 * @param mixed $caller caller object or caller string id
214
-	 */
215
-	public function debug($message, $caller = null) {
216
-		$this->logLevel($message, LoggerLevel::getLevelDebug(), $caller);
217
-	} 
184
+    /**
185
+     * Returns the parent of this category.
186
+     * @return Logger
187
+     */
188
+    public function getParent() {
189
+        return $this->parent;
190
+    }	  
191
+	
192
+    /**
193
+     * Returns the hierarchy used by this Logger.
194
+     * Caution: do not use this hierarchy unless you have called initialize().
195
+     * To get Loggers, use the Logger::getLogger and Logger::getRootLogger methods
196
+     * instead of operating on on the hierarchy directly.
197
+     * 
198
+     * @deprecated - will be moved to private
199
+     * @return LoggerHierarchy
200
+     */
201
+    public static function getHierarchy() {
202
+        if(!isset(self::$hierarchy)) {
203
+            self::$hierarchy = new LoggerHierarchy(new LoggerRoot());
204
+        }
205
+        return self::$hierarchy;
206
+    }
207
+	
208
+    /* Logging methods */
209
+    /**
210
+     * Log a message object with the DEBUG level including the caller.
211
+     *
212
+     * @param mixed $message message
213
+     * @param mixed $caller caller object or caller string id
214
+     */
215
+    public function debug($message, $caller = null) {
216
+        $this->logLevel($message, LoggerLevel::getLevelDebug(), $caller);
217
+    } 
218 218
 
219 219
 
220
-	/**
221
-	 * Log a message object with the INFO Level.
222
-	 *
223
-	 * @param mixed $message message
224
-	 * @param mixed $caller caller object or caller string id
225
-	 */
226
-	public function info($message, $caller = null) {
227
-		$this->logLevel($message, LoggerLevel::getLevelInfo(), $caller);
228
-	}
220
+    /**
221
+     * Log a message object with the INFO Level.
222
+     *
223
+     * @param mixed $message message
224
+     * @param mixed $caller caller object or caller string id
225
+     */
226
+    public function info($message, $caller = null) {
227
+        $this->logLevel($message, LoggerLevel::getLevelInfo(), $caller);
228
+    }
229 229
 
230
-	/**
231
-	 * Log a message with the WARN level.
232
-	 *
233
-	 * @param mixed $message message
234
-	 * @param mixed $caller caller object or caller string id
235
-	 */
236
-	public function warn($message, $caller = null) {
237
-		$this->logLevel($message, LoggerLevel::getLevelWarn(), $caller);
238
-	}
239
-	
240
-	/**
241
-	 * Log a message object with the ERROR level including the caller.
242
-	 *
243
-	 * @param mixed $message message
244
-	 * @param mixed $caller caller object or caller string id
245
-	 */
246
-	public function error($message, $caller = null) {
247
-		$this->logLevel($message, LoggerLevel::getLevelError(), $caller);
248
-	}
249
-	
250
-	/**
251
-	 * Log a message object with the FATAL level including the caller.
252
-	 *
253
-	 * @param mixed $message message
254
-	 * @param mixed $caller caller object or caller string id
255
-	 */
256
-	public function fatal($message, $caller = null) {
257
-		$this->logLevel($message, LoggerLevel::getLevelFatal(), $caller);
258
-	}
259
-	
260
-	/**
261
-	 * This method creates a new logging event and logs the event without further checks.
262
-	 *
263
-	 * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
264
-	 * {@link error()} and {@link fatal()} wrappers.
265
-	 *
266
-	 * @param string $fqcn Fully Qualified Class Name of the Logger
267
-	 * @param mixed $caller caller object or caller string id
268
-	 * @param LoggerLevel $level log level	   
269
-	 * @param mixed $message message
270
-	 * @see LoggerLoggingEvent			
271
-	 */
272
-	public function forcedLog($fqcn, $caller, $level, $message) {
273
-		$this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
274
-	} 
275
-	
276
-	
277
-		/**
278
-	 * Check whether this category is enabled for the DEBUG Level.
279
-	 * @return boolean
280
-	 */
281
-	public function isDebugEnabled() {
282
-		return $this->isEnabledFor(LoggerLevel::getLevelDebug());
283
-	}		
230
+    /**
231
+     * Log a message with the WARN level.
232
+     *
233
+     * @param mixed $message message
234
+     * @param mixed $caller caller object or caller string id
235
+     */
236
+    public function warn($message, $caller = null) {
237
+        $this->logLevel($message, LoggerLevel::getLevelWarn(), $caller);
238
+    }
239
+	
240
+    /**
241
+     * Log a message object with the ERROR level including the caller.
242
+     *
243
+     * @param mixed $message message
244
+     * @param mixed $caller caller object or caller string id
245
+     */
246
+    public function error($message, $caller = null) {
247
+        $this->logLevel($message, LoggerLevel::getLevelError(), $caller);
248
+    }
249
+	
250
+    /**
251
+     * Log a message object with the FATAL level including the caller.
252
+     *
253
+     * @param mixed $message message
254
+     * @param mixed $caller caller object or caller string id
255
+     */
256
+    public function fatal($message, $caller = null) {
257
+        $this->logLevel($message, LoggerLevel::getLevelFatal(), $caller);
258
+    }
259
+	
260
+    /**
261
+     * This method creates a new logging event and logs the event without further checks.
262
+     *
263
+     * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
264
+     * {@link error()} and {@link fatal()} wrappers.
265
+     *
266
+     * @param string $fqcn Fully Qualified Class Name of the Logger
267
+     * @param mixed $caller caller object or caller string id
268
+     * @param LoggerLevel $level log level	   
269
+     * @param mixed $message message
270
+     * @see LoggerLoggingEvent			
271
+     */
272
+    public function forcedLog($fqcn, $caller, $level, $message) {
273
+        $this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
274
+    } 
275
+	
276
+	
277
+        /**
278
+         * Check whether this category is enabled for the DEBUG Level.
279
+         * @return boolean
280
+         */
281
+    public function isDebugEnabled() {
282
+        return $this->isEnabledFor(LoggerLevel::getLevelDebug());
283
+    }		
284 284
 
285
-	/**
286
-	 * Check whether this category is enabled for a given Level passed as parameter.
287
-	 *
288
-	 * @param LoggerLevel level
289
-	 * @return boolean
290
-	 */
291
-	public function isEnabledFor($level) {
292
-		return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
293
-	} 
285
+    /**
286
+     * Check whether this category is enabled for a given Level passed as parameter.
287
+     *
288
+     * @param LoggerLevel level
289
+     * @return boolean
290
+     */
291
+    public function isEnabledFor($level) {
292
+        return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
293
+    } 
294 294
 
295
-	/**
296
-	 * Check whether this category is enabled for the info Level.
297
-	 * @return boolean
298
-	 * @see LoggerLevel
299
-	 */
300
-	public function isInfoEnabled() {
301
-		return $this->isEnabledFor(LoggerLevel::getLevelInfo());
302
-	} 
295
+    /**
296
+     * Check whether this category is enabled for the info Level.
297
+     * @return boolean
298
+     * @see LoggerLevel
299
+     */
300
+    public function isInfoEnabled() {
301
+        return $this->isEnabledFor(LoggerLevel::getLevelInfo());
302
+    } 
303 303
 
304
-	/**
305
-	 * This generic form is intended to be used by wrappers.
306
-	 *
307
-	 * @param LoggerLevel $priority a valid level
308
-	 * @param mixed $message message
309
-	 * @param mixed $caller caller object or caller string id
310
-	 */
311
-	public function log($priority, $message, $caller = null) {
312
-		if($this->isEnabledFor($priority)) {
313
-			$this->forcedLog($this->fqcn, $caller, $priority, $message);
314
-		}
315
-	}
316
-	
317
-	/**
318
-	 * If assertion parameter is false, then logs msg as an error statement.
319
-	 *
320
-	 * @param bool $assertion
321
-	 * @param string $msg message to log
322
-	 */
323
-	public function assertLog($assertion = true, $msg = '') {
324
-		if($assertion == false) {
325
-			$this->error($msg);
326
-		}
327
-	}
304
+    /**
305
+     * This generic form is intended to be used by wrappers.
306
+     *
307
+     * @param LoggerLevel $priority a valid level
308
+     * @param mixed $message message
309
+     * @param mixed $caller caller object or caller string id
310
+     */
311
+    public function log($priority, $message, $caller = null) {
312
+        if($this->isEnabledFor($priority)) {
313
+            $this->forcedLog($this->fqcn, $caller, $priority, $message);
314
+        }
315
+    }
316
+	
317
+    /**
318
+     * If assertion parameter is false, then logs msg as an error statement.
319
+     *
320
+     * @param bool $assertion
321
+     * @param string $msg message to log
322
+     */
323
+    public function assertLog($assertion = true, $msg = '') {
324
+        if($assertion == false) {
325
+            $this->error($msg);
326
+        }
327
+    }
328 328
 	 
329
-	private function logLevel($message, $level, $caller = null) {
330
-		if($level->isGreaterOrEqual($this->getEffectiveLevel())) {
331
-			$this->forcedLog($this->fqcn, $caller, $level, $message);
332
-		}
333
-	} 
334
-	
335
-	/* Factory methods */ 
336
-	
337
-	/**
338
-	 * Get a Logger by name (Delegate to {@link Logger})
339
-	 * 
340
-	 * @param string $name logger name
341
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
342
-	 * @return Logger
343
-	 * @static 
344
-	 */
345
-	public static function getLogger($name) {
346
-		if(!self::isInitialized()) {
347
-			self::initialize();
348
-		}
349
-		return self::getHierarchy()->getLogger($name);
350
-	}
351
-	
352
-	/**
353
-	 * get the Root Logger (Delegate to {@link Logger})
354
-	 * @return LoggerRoot
355
-	 * @static 
356
-	 */	   
357
-	public static function getRootLogger() {
358
-		if(!self::isInitialized()) {
359
-			self::initialize();
360
-		}
361
-		return self::getHierarchy()->getRootLogger();	  
362
-	}
363
-	
364
-	/* Configuration methods */
365
-	
366
-	/**
367
-	 * Add a new Appender to the list of appenders of this Category instance.
368
-	 *
369
-	 * @param LoggerAppender $newAppender
370
-	 */
371
-	public function addAppender($newAppender) {
372
-		$appenderName = $newAppender->getName();
373
-		$this->aai[$appenderName] = $newAppender;
374
-	}
375
-	
376
-	/**
377
-	 * Remove all previously added appenders from this Category instance.
378
-	 */
379
-	public function removeAllAppenders() {
380
-		$appenderNames = array_keys($this->aai);
381
-		$enumAppenders = count($appenderNames);
382
-		for($i = 0; $i < $enumAppenders; $i++) {
383
-			$this->removeAppender($appenderNames[$i]); 
384
-		}
385
-	} 
329
+    private function logLevel($message, $level, $caller = null) {
330
+        if($level->isGreaterOrEqual($this->getEffectiveLevel())) {
331
+            $this->forcedLog($this->fqcn, $caller, $level, $message);
332
+        }
333
+    } 
334
+	
335
+    /* Factory methods */ 
336
+	
337
+    /**
338
+     * Get a Logger by name (Delegate to {@link Logger})
339
+     * 
340
+     * @param string $name logger name
341
+     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
342
+     * @return Logger
343
+     * @static 
344
+     */
345
+    public static function getLogger($name) {
346
+        if(!self::isInitialized()) {
347
+            self::initialize();
348
+        }
349
+        return self::getHierarchy()->getLogger($name);
350
+    }
351
+	
352
+    /**
353
+     * get the Root Logger (Delegate to {@link Logger})
354
+     * @return LoggerRoot
355
+     * @static 
356
+     */	   
357
+    public static function getRootLogger() {
358
+        if(!self::isInitialized()) {
359
+            self::initialize();
360
+        }
361
+        return self::getHierarchy()->getRootLogger();	  
362
+    }
363
+	
364
+    /* Configuration methods */
365
+	
366
+    /**
367
+     * Add a new Appender to the list of appenders of this Category instance.
368
+     *
369
+     * @param LoggerAppender $newAppender
370
+     */
371
+    public function addAppender($newAppender) {
372
+        $appenderName = $newAppender->getName();
373
+        $this->aai[$appenderName] = $newAppender;
374
+    }
375
+	
376
+    /**
377
+     * Remove all previously added appenders from this Category instance.
378
+     */
379
+    public function removeAllAppenders() {
380
+        $appenderNames = array_keys($this->aai);
381
+        $enumAppenders = count($appenderNames);
382
+        for($i = 0; $i < $enumAppenders; $i++) {
383
+            $this->removeAppender($appenderNames[$i]); 
384
+        }
385
+    } 
386 386
 			
387
-	/**
388
-	 * Remove the appender passed as parameter form the list of appenders.
389
-	 *
390
-	 * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
391
-	 */
392
-	public function removeAppender($appender) {
393
-		if($appender instanceof LoggerAppender) {
394
-			$appender->close();
395
-			unset($this->aai[$appender->getName()]);
396
-		} else if (is_string($appender) and isset($this->aai[$appender])) {
397
-			$this->aai[$appender]->close();
398
-			unset($this->aai[$appender]);
399
-		}
400
-	} 
387
+    /**
388
+     * Remove the appender passed as parameter form the list of appenders.
389
+     *
390
+     * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
391
+     */
392
+    public function removeAppender($appender) {
393
+        if($appender instanceof LoggerAppender) {
394
+            $appender->close();
395
+            unset($this->aai[$appender->getName()]);
396
+        } else if (is_string($appender) and isset($this->aai[$appender])) {
397
+            $this->aai[$appender]->close();
398
+            unset($this->aai[$appender]);
399
+        }
400
+    } 
401 401
 			
402
-	/**
403
-	 * Call the appenders in the hierarchy starting at this.
404
-	 *
405
-	 * @param LoggerLoggingEvent $event 
406
-	 */
407
-	public function callAppenders($event) {
408
-		if(count($this->aai) > 0) {
409
-			foreach(array_keys($this->aai) as $appenderName) {
410
-				$this->aai[$appenderName]->doAppend($event);
411
-			}
412
-		}
413
-		if($this->parent != null and $this->getAdditivity()) {
414
-			$this->parent->callAppenders($event);
415
-		}
416
-	}
417
-	
418
-	/**
419
-	 * Get the appenders contained in this category as an array.
420
-	 * @return array collection of appenders
421
-	 */
422
-	public function getAllAppenders() {
423
-		return array_values($this->aai);
424
-	}
425
-	
426
-	/**
427
-	 * Look for the appender named as name.
428
-	 * @return LoggerAppender
429
-	 */
430
-	public function getAppender($name) {
431
-		return $this->aai[$name];
432
-	}
433
-	
434
-	/**
435
-	 * Get the additivity flag for this Category instance.
436
-	 * @return boolean
437
-	 */
438
-	public function getAdditivity() {
439
-		return $this->additive;
440
-	}
402
+    /**
403
+     * Call the appenders in the hierarchy starting at this.
404
+     *
405
+     * @param LoggerLoggingEvent $event 
406
+     */
407
+    public function callAppenders($event) {
408
+        if(count($this->aai) > 0) {
409
+            foreach(array_keys($this->aai) as $appenderName) {
410
+                $this->aai[$appenderName]->doAppend($event);
411
+            }
412
+        }
413
+        if($this->parent != null and $this->getAdditivity()) {
414
+            $this->parent->callAppenders($event);
415
+        }
416
+    }
417
+	
418
+    /**
419
+     * Get the appenders contained in this category as an array.
420
+     * @return array collection of appenders
421
+     */
422
+    public function getAllAppenders() {
423
+        return array_values($this->aai);
424
+    }
425
+	
426
+    /**
427
+     * Look for the appender named as name.
428
+     * @return LoggerAppender
429
+     */
430
+    public function getAppender($name) {
431
+        return $this->aai[$name];
432
+    }
433
+	
434
+    /**
435
+     * Get the additivity flag for this Category instance.
436
+     * @return boolean
437
+     */
438
+    public function getAdditivity() {
439
+        return $this->additive;
440
+    }
441 441
  
442
-	/**
443
-	 * Starting from this category, search the category hierarchy for a non-null level and return it.
444
-	 * @see LoggerLevel
445
-	 * @return LoggerLevel or null
446
-	 */
447
-	public function getEffectiveLevel() {
448
-		for($c = $this; $c != null; $c = $c->parent) {
449
-			if($c->getLevel() !== null) {
450
-				return $c->getLevel();
451
-			}
452
-		}
453
-		return null;
454
-	}
442
+    /**
443
+     * Starting from this category, search the category hierarchy for a non-null level and return it.
444
+     * @see LoggerLevel
445
+     * @return LoggerLevel or null
446
+     */
447
+    public function getEffectiveLevel() {
448
+        for($c = $this; $c != null; $c = $c->parent) {
449
+            if($c->getLevel() !== null) {
450
+                return $c->getLevel();
451
+            }
452
+        }
453
+        return null;
454
+    }
455 455
   
456
-	/**
457
-	 * Returns the assigned Level, if any, for this Category.
458
-	 * @return LoggerLevel or null 
459
-	 */
460
-	public function getLevel() {
461
-		return $this->level;
462
-	}
463
-	
464
-	/**
465
-	 * Set the level of this Category.
466
-	 *
467
-	 * @param LoggerLevel $level a level string or a level constant 
468
-	 */
469
-	public function setLevel($level) {
470
-		$this->level = $level;
471
-	}
472
-	
473
-	/**
474
-	 * Clears all logger definitions
475
-	 * 
476
-	 * @static
477
-	 * @return boolean 
478
-	 */
479
-	public static function clear() {
480
-		return self::getHierarchy()->clear();	 
481
-	}
482
-	
483
-	/**
484
-	 * Destroy configurations for logger definitions
485
-	 * 
486
-	 * @static
487
-	 * @return boolean 
488
-	 */
489
-	public static function resetConfiguration() {
490
-		$result = self::getHierarchy()->resetConfiguration();
491
-		self::$initialized = false;
492
-		self::$configurationClass = 'LoggerConfiguratorBasic';
493
-		self::$configurationFile = null;
494
-		return $result;	 
495
-	}
456
+    /**
457
+     * Returns the assigned Level, if any, for this Category.
458
+     * @return LoggerLevel or null 
459
+     */
460
+    public function getLevel() {
461
+        return $this->level;
462
+    }
463
+	
464
+    /**
465
+     * Set the level of this Category.
466
+     *
467
+     * @param LoggerLevel $level a level string or a level constant 
468
+     */
469
+    public function setLevel($level) {
470
+        $this->level = $level;
471
+    }
472
+	
473
+    /**
474
+     * Clears all logger definitions
475
+     * 
476
+     * @static
477
+     * @return boolean 
478
+     */
479
+    public static function clear() {
480
+        return self::getHierarchy()->clear();	 
481
+    }
482
+	
483
+    /**
484
+     * Destroy configurations for logger definitions
485
+     * 
486
+     * @static
487
+     * @return boolean 
488
+     */
489
+    public static function resetConfiguration() {
490
+        $result = self::getHierarchy()->resetConfiguration();
491
+        self::$initialized = false;
492
+        self::$configurationClass = 'LoggerConfiguratorBasic';
493
+        self::$configurationFile = null;
494
+        return $result;	 
495
+    }
496 496
 
497
-	/**
498
-	 * Safely close all appenders.
499
-	 * This is not longer necessary due the appenders shutdown via
500
-	 * destructors. 
501
-	 * @deprecated
502
-	 * @static
503
-	 */
504
-	public static function shutdown() {
505
-		return self::getHierarchy()->shutdown();	   
506
-	}
507
-	
508
-	/**
509
-	 * check if a given logger exists.
510
-	 * 
511
-	 * @param string $name logger name 
512
-	 * @static
513
-	 * @return boolean
514
-	 */
515
-	public static function exists($name) {
516
-		return self::getHierarchy()->exists($name);
517
-	}
518
-	
519
-	/**
520
-	 * Returns an array this whole Logger instances.
521
-	 * 
522
-	 * @static
523
-	 * @see Logger
524
-	 * @return array
525
-	 */
526
-	public static function getCurrentLoggers() {
527
-		return self::getHierarchy()->getCurrentLoggers();
528
-	}
529
-	
530
-	/**
531
-	 * Is the appender passed as parameter attached to this category?
532
-	 *
533
-	 * @param LoggerAppender $appender
534
-	 */
535
-	public function isAttached($appender) {
536
-		return isset($this->aai[$appender->getName()]);
537
-	} 
497
+    /**
498
+     * Safely close all appenders.
499
+     * This is not longer necessary due the appenders shutdown via
500
+     * destructors. 
501
+     * @deprecated
502
+     * @static
503
+     */
504
+    public static function shutdown() {
505
+        return self::getHierarchy()->shutdown();	   
506
+    }
507
+	
508
+    /**
509
+     * check if a given logger exists.
510
+     * 
511
+     * @param string $name logger name 
512
+     * @static
513
+     * @return boolean
514
+     */
515
+    public static function exists($name) {
516
+        return self::getHierarchy()->exists($name);
517
+    }
518
+	
519
+    /**
520
+     * Returns an array this whole Logger instances.
521
+     * 
522
+     * @static
523
+     * @see Logger
524
+     * @return array
525
+     */
526
+    public static function getCurrentLoggers() {
527
+        return self::getHierarchy()->getCurrentLoggers();
528
+    }
529
+	
530
+    /**
531
+     * Is the appender passed as parameter attached to this category?
532
+     *
533
+     * @param LoggerAppender $appender
534
+     */
535
+    public function isAttached($appender) {
536
+        return isset($this->aai[$appender->getName()]);
537
+    } 
538 538
 		   
539
-	/**
540
-	 * Set the additivity flag for this Category instance.
541
-	 *
542
-	 * @param boolean $additive
543
-	 */
544
-	public function setAdditivity($additive) {
545
-		$this->additive = (bool)$additive;
546
-	}
539
+    /**
540
+     * Set the additivity flag for this Category instance.
541
+     *
542
+     * @param boolean $additive
543
+     */
544
+    public function setAdditivity($additive) {
545
+        $this->additive = (bool)$additive;
546
+    }
547 547
 
548
-	/**
549
-	 * Sets the parent logger of this logger
550
-	 */
551
-	public function setParent(Logger $logger) {
552
-		$this->parent = $logger;
553
-	} 
554
-	
555
-	/**
556
-	 * Configures Log4PHP.
557
-	 * This method needs to be called before the first logging event
558
-	 * has occured. If this methode is never called, the standard configuration
559
-	 * takes place (@see LoggerConfiguratorBasic).
560
-	 * If only the configuration file is given, the configurator class will
561
-	 * be the XML Configurator or the INI Configurator, if no .xml ending
562
-	 * could be determined.
563
-	 * 
564
-	 * If a custom configurator should be used, the configuration file
565
-	 * is either null or the path to file the custom configurator uses.
566
-	 * Make sure the configurator is already or can be loaded by PHP when necessary.
567
-	 * 
568
-	 * @param String $configurationFile the configuration file
569
-	 * @param String $configurationClass the configurator class
570
-	 */
571
-	public static function configure($configurationFile = null, 
572
-									 $configurationClass = null ) {
573
-		if($configurationClass === null && $configurationFile === null) {
574
-			self::$configurationClass = 'LoggerConfiguratorBasic';
575
-			return;
576
-		}
548
+    /**
549
+     * Sets the parent logger of this logger
550
+     */
551
+    public function setParent(Logger $logger) {
552
+        $this->parent = $logger;
553
+    } 
554
+	
555
+    /**
556
+     * Configures Log4PHP.
557
+     * This method needs to be called before the first logging event
558
+     * has occured. If this methode is never called, the standard configuration
559
+     * takes place (@see LoggerConfiguratorBasic).
560
+     * If only the configuration file is given, the configurator class will
561
+     * be the XML Configurator or the INI Configurator, if no .xml ending
562
+     * could be determined.
563
+     * 
564
+     * If a custom configurator should be used, the configuration file
565
+     * is either null or the path to file the custom configurator uses.
566
+     * Make sure the configurator is already or can be loaded by PHP when necessary.
567
+     * 
568
+     * @param String $configurationFile the configuration file
569
+     * @param String $configurationClass the configurator class
570
+     */
571
+    public static function configure($configurationFile = null, 
572
+                                        $configurationClass = null ) {
573
+        if($configurationClass === null && $configurationFile === null) {
574
+            self::$configurationClass = 'LoggerConfiguratorBasic';
575
+            return;
576
+        }
577 577
 									 	
578
-		if($configurationClass !== null) {
579
-			self::$configurationFile = $configurationFile;
580
-			self::$configurationClass = $configurationClass;
581
-			return;
582
-		}
578
+        if($configurationClass !== null) {
579
+            self::$configurationFile = $configurationFile;
580
+            self::$configurationClass = $configurationClass;
581
+            return;
582
+        }
583 583
 		
584
-		if (strtolower(substr( $configurationFile, -4 )) == '.xml') {
585
-			self::$configurationFile = $configurationFile;
586
-			self::$configurationClass = 'LoggerConfiguratorXml';
587
-		} else {
588
-			self::$configurationFile = $configurationFile;
589
-			self::$configurationClass = 'LoggerConfiguratorIni';
590
-		}
591
-	}
592
-	
593
-	/**
594
-	 * Returns the current configurator
595
-	 * @return the configurator
596
-	 */
597
-	public static function getConfigurationClass() {
598
-		return self::$configurationClass;
599
-	}
600
-	
601
-	/**
602
-	 * Returns the current configuration file
603
-	 * @return the configuration file
604
-	 */
605
-	public static function getConfigurationFile() {
606
-		return self::$configurationFile;
607
-	}
608
-	
609
-	/**
610
-	 * Returns, true, if the log4php framework is already initialized
611
-	 */
612
-	private static function isInitialized() {
613
-		return self::$initialized;
614
-	}
615
-	
616
-	/**
617
-	 * Initializes the log4php framework.
618
-	 * @return boolean
619
-	 */
620
-	public static function initialize() {
621
-		self::$initialized = true;
622
-		$instance = LoggerReflectionUtils::createObject(self::$configurationClass);
623
-		$result = $instance->configure(self::getHierarchy(), self::$configurationFile);
624
-		return $result;
625
-	}
584
+        if (strtolower(substr( $configurationFile, -4 )) == '.xml') {
585
+            self::$configurationFile = $configurationFile;
586
+            self::$configurationClass = 'LoggerConfiguratorXml';
587
+        } else {
588
+            self::$configurationFile = $configurationFile;
589
+            self::$configurationClass = 'LoggerConfiguratorIni';
590
+        }
591
+    }
592
+	
593
+    /**
594
+     * Returns the current configurator
595
+     * @return the configurator
596
+     */
597
+    public static function getConfigurationClass() {
598
+        return self::$configurationClass;
599
+    }
600
+	
601
+    /**
602
+     * Returns the current configuration file
603
+     * @return the configuration file
604
+     */
605
+    public static function getConfigurationFile() {
606
+        return self::$configurationFile;
607
+    }
608
+	
609
+    /**
610
+     * Returns, true, if the log4php framework is already initialized
611
+     */
612
+    private static function isInitialized() {
613
+        return self::$initialized;
614
+    }
615
+	
616
+    /**
617
+     * Initializes the log4php framework.
618
+     * @return boolean
619
+     */
620
+    public static function initialize() {
621
+        self::$initialized = true;
622
+        $instance = LoggerReflectionUtils::createObject(self::$configurationClass);
623
+        $result = $instance->configure(self::getHierarchy(), self::$configurationFile);
624
+        return $result;
625
+    }
626 626
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerAppender.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
 	/**
210 210
 	 * Set the threshold level of this appender.
211 211
 	 *
212
-	 * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
212
+	 * @param LoggerLevel $threshold can be a {@link LoggerLevel} object or a string.
213 213
 	 * @see LoggerOptionConverter::toLevel()
214 214
 	 */
215 215
 	public function setThreshold($threshold) {
Please login to merge, or discard this patch.
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * Abstract class that defines output logs strategies.
@@ -26,236 +26,236 @@  discard block
 block discarded – undo
26 26
  */
27 27
 abstract class LoggerAppender {
28 28
 	
29
-	/**
30
-	 * @var boolean closed appender flag
31
-	 */
32
-	protected $closed = false;
29
+    /**
30
+     * @var boolean closed appender flag
31
+     */
32
+    protected $closed = false;
33 33
 	
34
-	/**
35
-	 * The first filter in the filter chain
36
-	 * @var LoggerFilter
37
-	 */
38
-	protected $filter = null;
34
+    /**
35
+     * The first filter in the filter chain
36
+     * @var LoggerFilter
37
+     */
38
+    protected $filter = null;
39 39
 			
40
-	/**
41
-	 * LoggerLayout for this appender. It can be null if appender has its own layout
42
-	 * @var LoggerLayout
43
-	 */
44
-	protected $layout = null; 
40
+    /**
41
+     * LoggerLayout for this appender. It can be null if appender has its own layout
42
+     * @var LoggerLayout
43
+     */
44
+    protected $layout = null; 
45 45
 		   
46
-	/**
47
-	 * @var string Appender name
48
-	 */
49
-	protected $name;
46
+    /**
47
+     * @var string Appender name
48
+     */
49
+    protected $name;
50 50
 		   
51
-	/**
52
-	 * @var LoggerLevel There is no level threshold filtering by default.
53
-	 */
54
-	protected $threshold = null;
51
+    /**
52
+     * @var LoggerLevel There is no level threshold filtering by default.
53
+     */
54
+    protected $threshold = null;
55 55
 	
56
-	/**
57
-	 * @var boolean needs a layout formatting ?
58
-	 */
59
-	protected $requiresLayout = false;
56
+    /**
57
+     * @var boolean needs a layout formatting ?
58
+     */
59
+    protected $requiresLayout = false;
60 60
 	
61
-	/**
62
-	 * Constructor
63
-	 *
64
-	 * @param string $name appender name
65
-	 */
66
-	public function __construct($name = '') {
67
-		$this->name = $name;
68
-	}
61
+    /**
62
+     * Constructor
63
+     *
64
+     * @param string $name appender name
65
+     */
66
+    public function __construct($name = '') {
67
+        $this->name = $name;
68
+    }
69 69
 
70
-	/**
71
-	 * Add a filter to the end of the filter list.
72
-	 *
73
-	 * @param LoggerFilter $newFilter add a new LoggerFilter
74
-	 */
75
-	public function addFilter($newFilter) {
76
-		if($this->filter === null) {
77
-			$this->filter = $newFilter;
78
-		} else {
79
-			$this->filter->addNext($newFilter);
80
-		}
81
-	}
70
+    /**
71
+     * Add a filter to the end of the filter list.
72
+     *
73
+     * @param LoggerFilter $newFilter add a new LoggerFilter
74
+     */
75
+    public function addFilter($newFilter) {
76
+        if($this->filter === null) {
77
+            $this->filter = $newFilter;
78
+        } else {
79
+            $this->filter->addNext($newFilter);
80
+        }
81
+    }
82 82
 	
83
-	/**
84
-	 * Clear the list of filters by removing all the filters in it.
85
-	 * @abstract
86
-	 */
87
-	public function clearFilters() {
88
-		unset($this->filter);
89
-		$this->filter = null;
90
-	}
83
+    /**
84
+     * Clear the list of filters by removing all the filters in it.
85
+     * @abstract
86
+     */
87
+    public function clearFilters() {
88
+        unset($this->filter);
89
+        $this->filter = null;
90
+    }
91 91
 
92
-	/**
93
-	 * Return the first filter in the filter chain for this Appender. 
94
-	 * The return value may be <i>null</i> if no is filter is set.
95
-	 * @return LoggerFilter
96
-	 */
97
-	public function getFilter() {
98
-		return $this->filter;
99
-	} 
92
+    /**
93
+     * Return the first filter in the filter chain for this Appender. 
94
+     * The return value may be <i>null</i> if no is filter is set.
95
+     * @return LoggerFilter
96
+     */
97
+    public function getFilter() {
98
+        return $this->filter;
99
+    } 
100 100
 	
101
-	/** 
102
-	 * Return the first filter in the filter chain for this Appender. 
103
-	 * The return value may be <i>null</i> if no is filter is set.
104
-	 * @return LoggerFilter
105
-	 */
106
-	public function getFirstFilter() {
107
-		return $this->filter;
108
-	}
101
+    /** 
102
+     * Return the first filter in the filter chain for this Appender. 
103
+     * The return value may be <i>null</i> if no is filter is set.
104
+     * @return LoggerFilter
105
+     */
106
+    public function getFirstFilter() {
107
+        return $this->filter;
108
+    }
109 109
 	
110 110
 	
111
-	/**
112
-	 * This method performs threshold checks and invokes filters before
113
-	 * delegating actual logging to the subclasses specific <i>append()</i> method.
114
-	 * @see LoggerAppender::doAppend()
115
-	 * @param LoggerLoggingEvent $event
116
-	 */
117
-	public function doAppend(LoggerLoggingEvent $event) {
118
-		if($this->closed) {
119
-			return;
120
-		}
111
+    /**
112
+     * This method performs threshold checks and invokes filters before
113
+     * delegating actual logging to the subclasses specific <i>append()</i> method.
114
+     * @see LoggerAppender::doAppend()
115
+     * @param LoggerLoggingEvent $event
116
+     */
117
+    public function doAppend(LoggerLoggingEvent $event) {
118
+        if($this->closed) {
119
+            return;
120
+        }
121 121
 		
122
-		if(!$this->isAsSevereAsThreshold($event->getLevel())) {
123
-			return;
124
-		}
122
+        if(!$this->isAsSevereAsThreshold($event->getLevel())) {
123
+            return;
124
+        }
125 125
 
126
-		$f = $this->getFirstFilter();
127
-		while($f !== null) {
128
-			switch ($f->decide($event)) {
129
-				case LoggerFilter::DENY: return;
130
-				case LoggerFilter::ACCEPT: return $this->append($event);
131
-				case LoggerFilter::NEUTRAL: $f = $f->getNext();
132
-			}
133
-		}
134
-		$this->append($event);	  
135
-	}	 
126
+        $f = $this->getFirstFilter();
127
+        while($f !== null) {
128
+            switch ($f->decide($event)) {
129
+                case LoggerFilter::DENY: return;
130
+                case LoggerFilter::ACCEPT: return $this->append($event);
131
+                case LoggerFilter::NEUTRAL: $f = $f->getNext();
132
+            }
133
+        }
134
+        $this->append($event);	  
135
+    }	 
136 136
 
137
-	/**
138
-	 * Set the Layout for this appender.
139
-	 * @see LoggerAppender::setLayout()
140
-	 * @param LoggerLayout $layout
141
-	 */
142
-	public function setLayout($layout) {
143
-		if($this->requiresLayout()) {
144
-			$this->layout = $layout;
145
-		}
146
-	} 
137
+    /**
138
+     * Set the Layout for this appender.
139
+     * @see LoggerAppender::setLayout()
140
+     * @param LoggerLayout $layout
141
+     */
142
+    public function setLayout($layout) {
143
+        if($this->requiresLayout()) {
144
+            $this->layout = $layout;
145
+        }
146
+    } 
147 147
 	
148
-	/**
149
-	 * Returns this appender layout.
150
-	 * @see LoggerAppender::getLayout()
151
-	 * @return LoggerLayout
152
-	 */
153
-	public function getLayout() {
154
-		return $this->layout;
155
-	}
148
+    /**
149
+     * Returns this appender layout.
150
+     * @see LoggerAppender::getLayout()
151
+     * @return LoggerLayout
152
+     */
153
+    public function getLayout() {
154
+        return $this->layout;
155
+    }
156 156
 	
157
-	/**
158
-	 * Configurators call this method to determine if the appender
159
-	 * requires a layout. 
160
-	 *
161
-	 * <p>If this method returns <i>true</i>, meaning that layout is required, 
162
-	 * then the configurator will configure a layout using the configuration 
163
-	 * information at its disposal.	 If this method returns <i>false</i>, 
164
-	 * meaning that a layout is not required, then layout configuration will be
165
-	 * skipped even if there is available layout configuration
166
-	 * information at the disposal of the configurator.</p>
167
-	 *
168
-	 * <p>In the rather exceptional case, where the appender
169
-	 * implementation admits a layout but can also work without it, then
170
-	 * the appender should return <i>true</i>.</p>
171
-	 * 
172
-	 * @see LoggerAppender::requiresLayout()
173
-	 * @return boolean
174
-	 */
175
-	public function requiresLayout() {
176
-		return $this->requiresLayout;
177
-	}
157
+    /**
158
+     * Configurators call this method to determine if the appender
159
+     * requires a layout. 
160
+     *
161
+     * <p>If this method returns <i>true</i>, meaning that layout is required, 
162
+     * then the configurator will configure a layout using the configuration 
163
+     * information at its disposal.	 If this method returns <i>false</i>, 
164
+     * meaning that a layout is not required, then layout configuration will be
165
+     * skipped even if there is available layout configuration
166
+     * information at the disposal of the configurator.</p>
167
+     *
168
+     * <p>In the rather exceptional case, where the appender
169
+     * implementation admits a layout but can also work without it, then
170
+     * the appender should return <i>true</i>.</p>
171
+     * 
172
+     * @see LoggerAppender::requiresLayout()
173
+     * @return boolean
174
+     */
175
+    public function requiresLayout() {
176
+        return $this->requiresLayout;
177
+    }
178 178
 	
179
-	/**
180
-	 * Get the name of this appender.
181
-	 * @see LoggerAppender::getName()
182
-	 * @return string
183
-	 */
184
-	public function getName() {
185
-		return $this->name;
186
-	}
179
+    /**
180
+     * Get the name of this appender.
181
+     * @see LoggerAppender::getName()
182
+     * @return string
183
+     */
184
+    public function getName() {
185
+        return $this->name;
186
+    }
187 187
 	
188 188
 /**
189
-	 * Set the name of this appender.
190
-	 *
191
-	 * The name is used by other components to identify this appender.
192
-	 *
193
-	 * 
194
-	 * @param string $name
195
-	 */
196
-	public function setName($name) {
197
-		$this->name = $name;	
198
-	}
189
+ * Set the name of this appender.
190
+ *
191
+ * The name is used by other components to identify this appender.
192
+ *
193
+ * 
194
+ * @param string $name
195
+ */
196
+    public function setName($name) {
197
+        $this->name = $name;	
198
+    }
199 199
 	
200
-	/**
201
-	 * Returns this appenders threshold level. 
202
-	 * See the {@link setThreshold()} method for the meaning of this option.
203
-	 * @return LoggerLevel
204
-	 */
205
-	public function getThreshold() { 
206
-		return $this->threshold;
207
-	}
200
+    /**
201
+     * Returns this appenders threshold level. 
202
+     * See the {@link setThreshold()} method for the meaning of this option.
203
+     * @return LoggerLevel
204
+     */
205
+    public function getThreshold() { 
206
+        return $this->threshold;
207
+    }
208 208
 	
209
-	/**
210
-	 * Set the threshold level of this appender.
211
-	 *
212
-	 * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
213
-	 * @see LoggerOptionConverter::toLevel()
214
-	 */
215
-	public function setThreshold($threshold) {
216
-		if(is_string($threshold)) {
217
-		   $this->threshold = LoggerOptionConverter::toLevel($threshold, null);
218
-		} else if($threshold instanceof LoggerLevel) {
219
-		   $this->threshold = $threshold;
220
-		}
221
-	}
209
+    /**
210
+     * Set the threshold level of this appender.
211
+     *
212
+     * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
213
+     * @see LoggerOptionConverter::toLevel()
214
+     */
215
+    public function setThreshold($threshold) {
216
+        if(is_string($threshold)) {
217
+            $this->threshold = LoggerOptionConverter::toLevel($threshold, null);
218
+        } else if($threshold instanceof LoggerLevel) {
219
+            $this->threshold = $threshold;
220
+        }
221
+    }
222 222
 	
223
-	/**
224
-	 * Check whether the message level is below the appender's threshold. 
225
-	 *
226
-	 *
227
-	 * If there is no threshold set, then the return value is always <i>true</i>.
228
-	 * @param LoggerLevel $level
229
-	 * @return boolean true if priority is greater or equal than threshold	
230
-	 */
231
-	public function isAsSevereAsThreshold($level) {
232
-		if($this->threshold === null) {
233
-			return true;
234
-		}
235
-		return $level->isGreaterOrEqual($this->getThreshold());
236
-	}
223
+    /**
224
+     * Check whether the message level is below the appender's threshold. 
225
+     *
226
+     *
227
+     * If there is no threshold set, then the return value is always <i>true</i>.
228
+     * @param LoggerLevel $level
229
+     * @return boolean true if priority is greater or equal than threshold	
230
+     */
231
+    public function isAsSevereAsThreshold($level) {
232
+        if($this->threshold === null) {
233
+            return true;
234
+        }
235
+        return $level->isGreaterOrEqual($this->getThreshold());
236
+    }
237 237
 
238
-	/**
239
-	 * Derived appenders should override this method if option structure
240
-	 * requires it.
241
-	 */
242
-	abstract public function activateOptions();	   
238
+    /**
239
+     * Derived appenders should override this method if option structure
240
+     * requires it.
241
+     */
242
+    abstract public function activateOptions();	   
243 243
 	
244
-	/**
245
-	 * Subclasses of {@link LoggerAppender} should implement 
246
-	 * this method to perform actual logging.
247
-	 *
248
-	 * @param LoggerLoggingEvent $event
249
-	 * @see doAppend()
250
-	 * @abstract
251
-	 */
252
-	abstract protected function append(LoggerLoggingEvent $event); 
244
+    /**
245
+     * Subclasses of {@link LoggerAppender} should implement 
246
+     * this method to perform actual logging.
247
+     *
248
+     * @param LoggerLoggingEvent $event
249
+     * @see doAppend()
250
+     * @abstract
251
+     */
252
+    abstract protected function append(LoggerLoggingEvent $event); 
253 253
 
254
-	/**
255
-	 * Release any resources allocated.
256
-	 * Subclasses of {@link LoggerAppender} should implement 
257
-	 * this method to perform proper closing procedures.
258
-	 * @abstract
259
-	 */
260
-	abstract public function close();
254
+    /**
255
+     * Release any resources allocated.
256
+     * Subclasses of {@link LoggerAppender} should implement 
257
+     * this method to perform proper closing procedures.
258
+     * @abstract
259
+     */
260
+    abstract public function close();
261 261
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param LoggerFilter $newFilter add a new LoggerFilter
74 74
 	 */
75 75
 	public function addFilter($newFilter) {
76
-		if($this->filter === null) {
76
+		if ($this->filter === null) {
77 77
 			$this->filter = $newFilter;
78 78
 		} else {
79 79
 			$this->filter->addNext($newFilter);
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	 * @param LoggerLoggingEvent $event
116 116
 	 */
117 117
 	public function doAppend(LoggerLoggingEvent $event) {
118
-		if($this->closed) {
118
+		if ($this->closed) {
119 119
 			return;
120 120
 		}
121 121
 		
122
-		if(!$this->isAsSevereAsThreshold($event->getLevel())) {
122
+		if (!$this->isAsSevereAsThreshold($event->getLevel())) {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		$f = $this->getFirstFilter();
127
-		while($f !== null) {
127
+		while ($f !== null) {
128 128
 			switch ($f->decide($event)) {
129 129
 				case LoggerFilter::DENY: return;
130 130
 				case LoggerFilter::ACCEPT: return $this->append($event);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @param LoggerLayout $layout
141 141
 	 */
142 142
 	public function setLayout($layout) {
143
-		if($this->requiresLayout()) {
143
+		if ($this->requiresLayout()) {
144 144
 			$this->layout = $layout;
145 145
 		}
146 146
 	} 
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	 * @see LoggerOptionConverter::toLevel()
214 214
 	 */
215 215
 	public function setThreshold($threshold) {
216
-		if(is_string($threshold)) {
216
+		if (is_string($threshold)) {
217 217
 		   $this->threshold = LoggerOptionConverter::toLevel($threshold, null);
218
-		} else if($threshold instanceof LoggerLevel) {
218
+		} else if ($threshold instanceof LoggerLevel) {
219 219
 		   $this->threshold = $threshold;
220 220
 		}
221 221
 	}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return boolean true if priority is greater or equal than threshold	
230 230
 	 */
231 231
 	public function isAsSevereAsThreshold($level) {
232
-		if($this->threshold === null) {
232
+		if ($this->threshold === null) {
233 233
 			return true;
234 234
 		}
235 235
 		return $level->isGreaterOrEqual($this->getThreshold());
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerHierarchy.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	
72 72
 	/**
73 73
 	 * Create a new logger hierarchy.
74
-	 * @param object $root the root logger
74
+	 * @param LoggerRoot $root the root logger
75 75
 	 */
76 76
 	public function __construct(LoggerRoot $root) {
77 77
 		$this->root = $root;
@@ -107,7 +107,6 @@  discard block
 block discarded – undo
107 107
 	 * Return a new logger instance named as the first parameter using the default factory.
108 108
 	 * 
109 109
 	 * @param string $name logger name
110
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null	  
111 110
 	 * @return Logger
112 111
 	 */
113 112
 	public function getLogger($name) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @return Logger
112 112
 	 */
113 113
 	public function getLogger($name) {
114
-		if(!isset($this->ht[$name])) {
115
-			$this->ht[$name] = new Logger($name);;
114
+		if (!isset($this->ht[$name])) {
115
+			$this->ht[$name] = new Logger($name); ;
116 116
 			// TODO: isn't necessary, access via singleton?
117 117
 			// $this->ht[$name]->setHierarchy($this);
118 118
 			$nodes = explode('.', $name);
119 119
 			$firstNode = array_shift($nodes);
120 120
 			
121 121
 			// if name is not a first node but another first node is their
122
-			if($firstNode != $name and isset($this->ht[$firstNode])) {
122
+			if ($firstNode != $name and isset($this->ht[$firstNode])) {
123 123
 				$this->ht[$name]->setParent($this->ht[$firstNode]);
124 124
 			} else {
125 125
 				// if there is no father, set root logger as father
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 			} 
128 128
 		
129 129
 			// if there are more nodes than one
130
-			if(count($nodes) > 0) {
130
+			if (count($nodes) > 0) {
131 131
 				// find parent node
132
-				foreach($nodes as $node) {
132
+				foreach ($nodes as $node) {
133 133
 					$parentNode = "$firstNode.$node";
134
-					if(isset($this->ht[$parentNode]) and $parentNode != $name) {
134
+					if (isset($this->ht[$parentNode]) and $parentNode != $name) {
135 135
 		
136 136
 						$this->ht[$name]->setParent($this->ht[$parentNode]);
137 137
 					}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return LoggerRoot Get the root of this hierarchy.
155 155
 	 */ 
156 156
 	public function getRootLogger() {
157
-		if(!isset($this->root) or $this->root == null) {
157
+		if (!isset($this->root) or $this->root == null) {
158 158
 			$this->root = new LoggerRoot();
159 159
 		}
160 160
 		return $this->root;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		$this->shutDown();
200 200
 		$loggers = $this->getCurrentLoggers();
201 201
 		$enumLoggers = count($loggers);
202
-		for($i = 0; $i < $enumLoggers; $i++) {
202
+		for ($i = 0; $i < $enumLoggers; $i++) {
203 203
 			$loggers[$i]->setLevel(null);
204 204
 			$loggers[$i]->setAdditivity(true);
205 205
 			$loggers[$i]->removeAllAppenders();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param LoggerLevel $l
214 214
 	 */
215 215
 	public function setThreshold(LoggerLevel $l) {
216
-		if($l !== null) {
216
+		if ($l !== null) {
217 217
 			$this->threshold = $l;
218 218
 		}
219 219
 	}
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		$this->root->removeAllAppenders();
237 237
 		$cats = $this->getCurrentLoggers();
238 238
 		$enumCats = count($cats);		  
239
-		if($enumCats > 0) {
240
-			for($i = 0; $i < $enumCats; $i++) {
239
+		if ($enumCats > 0) {
240
+			for ($i = 0; $i < $enumCats; $i++) {
241 241
 				$cats[$i]->removeAllAppenders();
242 242
 			}
243 243
 		}
Please login to merge, or discard this patch.
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -47,199 +47,199 @@
 block discarded – undo
47 47
  * @version $Revision: 822448 $
48 48
  * @package log4php
49 49
  */
50
- /*
50
+    /*
51 51
   * TODO:
52 52
   * - addHierarchyEventListener($listener) not supported
53 53
   * - emitNoAppenderWarning($cat) not supported
54 54
   * - fireAddAppenderEvent not supported
55 55
   */
56 56
 class LoggerHierarchy {
57
-	/** Default Factory  */
58
-	protected $defaultFactory;
57
+    /** Default Factory  */
58
+    protected $defaultFactory;
59 59
 	
60
-	/** array hierarchy tree. saves here all loggers */
61
-	protected $ht = array();
60
+    /** array hierarchy tree. saves here all loggers */
61
+    protected $ht = array();
62 62
 	
63
-	/** The root Logger */
64
-	protected $root = null;
63
+    /** The root Logger */
64
+    protected $root = null;
65 65
 	
66
-	/** LoggerRendererMap */
67
-	protected $rendererMap;
66
+    /** LoggerRendererMap */
67
+    protected $rendererMap;
68 68
 
69
-	/** LoggerLevel main level threshold */
70
-	protected $threshold;
69
+    /** LoggerLevel main level threshold */
70
+    protected $threshold;
71 71
 	
72
-	/**
73
-	 * Create a new logger hierarchy.
74
-	 * @param object $root the root logger
75
-	 */
76
-	public function __construct(LoggerRoot $root) {
77
-		$this->root = $root;
78
-		$this->setThreshold(LoggerLevel::getLevelAll());
79
-		$this->rendererMap = new LoggerRendererMap();
80
-	}
72
+    /**
73
+     * Create a new logger hierarchy.
74
+     * @param object $root the root logger
75
+     */
76
+    public function __construct(LoggerRoot $root) {
77
+        $this->root = $root;
78
+        $this->setThreshold(LoggerLevel::getLevelAll());
79
+        $this->rendererMap = new LoggerRendererMap();
80
+    }
81 81
 	 
82
-	/**
83
-	 * This call will clear all logger definitions from the internal hashtable.
84
-	 */
85
-	public function clear() {
86
-		$this->ht = array();
87
-	}
82
+    /**
83
+     * This call will clear all logger definitions from the internal hashtable.
84
+     */
85
+    public function clear() {
86
+        $this->ht = array();
87
+    }
88 88
 	  
89
-	/**
90
-	 * Check if the named logger exists in the hierarchy.
91
-	 * @param string $name
92
-	 * @return boolean
93
-	 */
94
-	public function exists($name) {
95
-		return isset($this->ht[$name]);
96
-	}
89
+    /**
90
+     * Check if the named logger exists in the hierarchy.
91
+     * @param string $name
92
+     * @return boolean
93
+     */
94
+    public function exists($name) {
95
+        return isset($this->ht[$name]);
96
+    }
97 97
 
98
-	/**
99
-	 * Returns all the currently defined categories in this hierarchy as an array.
100
-	 * @return array
101
-	 */	 
102
-	public function getCurrentLoggers() {
103
-		return array_values($this->ht);
104
-	}
98
+    /**
99
+     * Returns all the currently defined categories in this hierarchy as an array.
100
+     * @return array
101
+     */	 
102
+    public function getCurrentLoggers() {
103
+        return array_values($this->ht);
104
+    }
105 105
 	
106
-	/**
107
-	 * Return a new logger instance named as the first parameter using the default factory.
108
-	 * 
109
-	 * @param string $name logger name
110
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null	  
111
-	 * @return Logger
112
-	 */
113
-	public function getLogger($name) {
114
-		if(!isset($this->ht[$name])) {
115
-			$this->ht[$name] = new Logger($name);;
116
-			// TODO: isn't necessary, access via singleton?
117
-			// $this->ht[$name]->setHierarchy($this);
118
-			$nodes = explode('.', $name);
119
-			$firstNode = array_shift($nodes);
106
+    /**
107
+     * Return a new logger instance named as the first parameter using the default factory.
108
+     * 
109
+     * @param string $name logger name
110
+     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null	  
111
+     * @return Logger
112
+     */
113
+    public function getLogger($name) {
114
+        if(!isset($this->ht[$name])) {
115
+            $this->ht[$name] = new Logger($name);;
116
+            // TODO: isn't necessary, access via singleton?
117
+            // $this->ht[$name]->setHierarchy($this);
118
+            $nodes = explode('.', $name);
119
+            $firstNode = array_shift($nodes);
120 120
 			
121
-			// if name is not a first node but another first node is their
122
-			if($firstNode != $name and isset($this->ht[$firstNode])) {
123
-				$this->ht[$name]->setParent($this->ht[$firstNode]);
124
-			} else {
125
-				// if there is no father, set root logger as father
126
-				$this->ht[$name]->setParent($this->root);
127
-			} 
121
+            // if name is not a first node but another first node is their
122
+            if($firstNode != $name and isset($this->ht[$firstNode])) {
123
+                $this->ht[$name]->setParent($this->ht[$firstNode]);
124
+            } else {
125
+                // if there is no father, set root logger as father
126
+                $this->ht[$name]->setParent($this->root);
127
+            } 
128 128
 		
129
-			// if there are more nodes than one
130
-			if(count($nodes) > 0) {
131
-				// find parent node
132
-				foreach($nodes as $node) {
133
-					$parentNode = "$firstNode.$node";
134
-					if(isset($this->ht[$parentNode]) and $parentNode != $name) {
129
+            // if there are more nodes than one
130
+            if(count($nodes) > 0) {
131
+                // find parent node
132
+                foreach($nodes as $node) {
133
+                    $parentNode = "$firstNode.$node";
134
+                    if(isset($this->ht[$parentNode]) and $parentNode != $name) {
135 135
 		
136
-						$this->ht[$name]->setParent($this->ht[$parentNode]);
137
-					}
138
-					$firstNode .= ".$node";
139
-				}
140
-			}
141
-		}		
136
+                        $this->ht[$name]->setParent($this->ht[$parentNode]);
137
+                    }
138
+                    $firstNode .= ".$node";
139
+                }
140
+            }
141
+        }		
142 142
 		
143
-		return $this->ht[$name];
144
-	} 
143
+        return $this->ht[$name];
144
+    } 
145 145
 	
146
-	/**
147
-	 * @return LoggerRendererMap Get the renderer map for this hierarchy.
148
-	 */
149
-	public function getRendererMap() {
150
-		return $this->rendererMap;
151
-	}
146
+    /**
147
+     * @return LoggerRendererMap Get the renderer map for this hierarchy.
148
+     */
149
+    public function getRendererMap() {
150
+        return $this->rendererMap;
151
+    }
152 152
 	
153
-	/**
154
-	 * @return LoggerRoot Get the root of this hierarchy.
155
-	 */ 
156
-	public function getRootLogger() {
157
-		if(!isset($this->root) or $this->root == null) {
158
-			$this->root = new LoggerRoot();
159
-		}
160
-		return $this->root;
161
-	}
153
+    /**
154
+     * @return LoggerRoot Get the root of this hierarchy.
155
+     */ 
156
+    public function getRootLogger() {
157
+        if(!isset($this->root) or $this->root == null) {
158
+            $this->root = new LoggerRoot();
159
+        }
160
+        return $this->root;
161
+    }
162 162
 	 
163
-	/**
164
-	 * @return LoggerLevel Returns the threshold Level.
165
-	 */
166
-	public function getThreshold() {
167
-		return $this->threshold;
168
-	} 
163
+    /**
164
+     * @return LoggerLevel Returns the threshold Level.
165
+     */
166
+    public function getThreshold() {
167
+        return $this->threshold;
168
+    } 
169 169
 
170
-	/**
171
-	 * This method will return true if this repository is disabled 
172
-	 * for level object passed as parameter and false otherwise.
173
-	 * @return boolean
174
-	 */
175
-	public function isDisabled(LoggerLevel $level) {
176
-		return ($this->threshold->toInt() > $level->toInt());
177
-	}
170
+    /**
171
+     * This method will return true if this repository is disabled 
172
+     * for level object passed as parameter and false otherwise.
173
+     * @return boolean
174
+     */
175
+    public function isDisabled(LoggerLevel $level) {
176
+        return ($this->threshold->toInt() > $level->toInt());
177
+    }
178 178
 	
179
-	/**
180
-	 * Reset all values contained in this hierarchy instance to their
181
-	 * default. 
182
-	 *
183
-	 * This removes all appenders from all categories, sets
184
-	 * the level of all non-root categories to <i>null</i>,
185
-	 * sets their additivity flag to <i>true</i> and sets the level
186
-	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.  Moreover,
187
-	 * message disabling is set its default "off" value.
188
-	 * 
189
-	 * <p>Existing categories are not removed. They are just reset.
190
-	 *
191
-	 * <p>This method should be used sparingly and with care as it will
192
-	 * block all logging until it is completed.</p>
193
-	 */
194
-	public function resetConfiguration() {
195
-		$root = $this->getRootLogger();
179
+    /**
180
+     * Reset all values contained in this hierarchy instance to their
181
+     * default. 
182
+     *
183
+     * This removes all appenders from all categories, sets
184
+     * the level of all non-root categories to <i>null</i>,
185
+     * sets their additivity flag to <i>true</i> and sets the level
186
+     * of the root logger to {@link LOGGER_LEVEL_DEBUG}.  Moreover,
187
+     * message disabling is set its default "off" value.
188
+     * 
189
+     * <p>Existing categories are not removed. They are just reset.
190
+     *
191
+     * <p>This method should be used sparingly and with care as it will
192
+     * block all logging until it is completed.</p>
193
+     */
194
+    public function resetConfiguration() {
195
+        $root = $this->getRootLogger();
196 196
 		
197
-		$root->setLevel(LoggerLevel::getLevelDebug());
198
-		$this->setThreshold(LoggerLevel::getLevelAll());
199
-		$this->shutDown();
200
-		$loggers = $this->getCurrentLoggers();
201
-		$enumLoggers = count($loggers);
202
-		for($i = 0; $i < $enumLoggers; $i++) {
203
-			$loggers[$i]->setLevel(null);
204
-			$loggers[$i]->setAdditivity(true);
205
-			$loggers[$i]->removeAllAppenders();
206
-		}
207
-		$this->rendererMap->clear();
208
-	}
197
+        $root->setLevel(LoggerLevel::getLevelDebug());
198
+        $this->setThreshold(LoggerLevel::getLevelAll());
199
+        $this->shutDown();
200
+        $loggers = $this->getCurrentLoggers();
201
+        $enumLoggers = count($loggers);
202
+        for($i = 0; $i < $enumLoggers; $i++) {
203
+            $loggers[$i]->setLevel(null);
204
+            $loggers[$i]->setAdditivity(true);
205
+            $loggers[$i]->removeAllAppenders();
206
+        }
207
+        $this->rendererMap->clear();
208
+    }
209 209
 	
210
-	/**
211
-	 * set a new threshold level
212
-	 *
213
-	 * @param LoggerLevel $l
214
-	 */
215
-	public function setThreshold(LoggerLevel $l) {
216
-		if($l !== null) {
217
-			$this->threshold = $l;
218
-		}
219
-	}
210
+    /**
211
+     * set a new threshold level
212
+     *
213
+     * @param LoggerLevel $l
214
+     */
215
+    public function setThreshold(LoggerLevel $l) {
216
+        if($l !== null) {
217
+            $this->threshold = $l;
218
+        }
219
+    }
220 220
 	
221
-	/**
222
-	 * Shutting down a hierarchy will <i>safely</i> close and remove
223
-	 * all appenders in all categories including the root logger.
224
-	 * 
225
-	 * <p>Some appenders such as {@link LoggerSocketAppender}
226
-	 * need to be closed before the
227
-	 * application exists. Otherwise, pending logging events might be
228
-	 * lost.
229
-	 * 
230
-	 * <p>The shutdown method is careful to close nested
231
-	 * appenders before closing regular appenders. This is allows
232
-	 * configurations where a regular appender is attached to a logger
233
-	 * and again to a nested appender.
234
-	 */
235
-	public function shutdown() {
236
-		$this->root->removeAllAppenders();
237
-		$cats = $this->getCurrentLoggers();
238
-		$enumCats = count($cats);		  
239
-		if($enumCats > 0) {
240
-			for($i = 0; $i < $enumCats; $i++) {
241
-				$cats[$i]->removeAllAppenders();
242
-			}
243
-		}
244
-	}
221
+    /**
222
+     * Shutting down a hierarchy will <i>safely</i> close and remove
223
+     * all appenders in all categories including the root logger.
224
+     * 
225
+     * <p>Some appenders such as {@link LoggerSocketAppender}
226
+     * need to be closed before the
227
+     * application exists. Otherwise, pending logging events might be
228
+     * lost.
229
+     * 
230
+     * <p>The shutdown method is careful to close nested
231
+     * appenders before closing regular appenders. This is allows
232
+     * configurations where a regular appender is attached to a logger
233
+     * and again to a nested appender.
234
+     */
235
+    public function shutdown() {
236
+        $this->root->removeAllAppenders();
237
+        $cats = $this->getCurrentLoggers();
238
+        $enumCats = count($cats);		  
239
+        if($enumCats > 0) {
240
+            for($i = 0; $i < $enumCats; $i++) {
241
+                $cats[$i]->removeAllAppenders();
242
+            }
243
+        }
244
+    }
245 245
 } 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerLevel.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Two priorities are equal if their level fields are equal.
80 80
 	 *
81
-	 * @param object $o
82
-	 * @return boolean 
81
+	 * @param LoggerLevel $o
82
+	 * @return boolean|null 
83 83
 	 */
84 84
 	public function equals($o) {
85 85
 		if($o instanceof LoggerLevel) {
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * Convert the string passed as argument to a level. If the
221 221
 	 * conversion fails, then this method returns a DEBUG Level.
222 222
 	 *
223
-	 * @param mixed $arg
224
-	 * @param LoggerLevel $default
223
+	 * @param string $arg
224
+	 * @param LoggerLevel $defaultLevel
225 225
 	 * @static 
226 226
 	 */
227 227
 	public static function toLevel($arg, $defaultLevel = null) {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @return boolean 
83 83
 	 */
84 84
 	public function equals($o) {
85
-		if($o instanceof LoggerLevel) {
86
-			if($this->level == $o->level) {
85
+		if ($o instanceof LoggerLevel) {
86
+			if ($this->level == $o->level) {
87 87
 			    return true;
88 88
 			}
89 89
 		} else {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @return LoggerLevel
98 98
 	 */
99 99
 	public static function getLevelOff() {
100
-		if(!isset(self::$levelMap[LoggerLevel::OFF])) {
100
+		if (!isset(self::$levelMap[LoggerLevel::OFF])) {
101 101
 			self::$levelMap[LoggerLevel::OFF] = new LoggerLevel(LoggerLevel::OFF, 'OFF', 0);
102 102
 		}
103 103
 		return self::$levelMap[LoggerLevel::OFF];
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return LoggerLevel
110 110
 	 */
111 111
 	public static function getLevelFatal() {
112
-		if(!isset(self::$levelMap[LoggerLevel::FATAL])) {
112
+		if (!isset(self::$levelMap[LoggerLevel::FATAL])) {
113 113
 			self::$levelMap[LoggerLevel::FATAL] = new LoggerLevel(LoggerLevel::FATAL, 'FATAL', 0);
114 114
 		}
115 115
 		return self::$levelMap[LoggerLevel::FATAL];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return LoggerLevel
122 122
 	 */
123 123
 	public static function getLevelError() {
124
-		if(!isset(self::$levelMap[LoggerLevel::ERROR])) {
124
+		if (!isset(self::$levelMap[LoggerLevel::ERROR])) {
125 125
 			self::$levelMap[LoggerLevel::ERROR] = new LoggerLevel(LoggerLevel::ERROR, 'ERROR', 3);
126 126
 		}
127 127
 		return self::$levelMap[LoggerLevel::ERROR];
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return LoggerLevel
134 134
 	 */
135 135
 	public static function getLevelWarn() {
136
-		if(!isset(self::$levelMap[LoggerLevel::WARN])) {
136
+		if (!isset(self::$levelMap[LoggerLevel::WARN])) {
137 137
 			self::$levelMap[LoggerLevel::WARN] = new LoggerLevel(LoggerLevel::WARN, 'WARN', 4);
138 138
 		}
139 139
 		return self::$levelMap[LoggerLevel::WARN];
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return LoggerLevel
146 146
 	 */
147 147
 	public static function getLevelInfo() {
148
-		if(!isset(self::$levelMap[LoggerLevel::INFO])) {
148
+		if (!isset(self::$levelMap[LoggerLevel::INFO])) {
149 149
 			self::$levelMap[LoggerLevel::INFO] = new LoggerLevel(LoggerLevel::INFO, 'INFO', 6);
150 150
 		}
151 151
 		return self::$levelMap[LoggerLevel::INFO];
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return LoggerLevel
158 158
 	 */
159 159
 	public static function getLevelDebug() {
160
-		if(!isset(self::$levelMap[LoggerLevel::DEBUG])) {
160
+		if (!isset(self::$levelMap[LoggerLevel::DEBUG])) {
161 161
 			self::$levelMap[LoggerLevel::DEBUG] = new LoggerLevel(LoggerLevel::DEBUG, 'DEBUG', 7);
162 162
 		}
163 163
 		return self::$levelMap[LoggerLevel::DEBUG];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return LoggerLevel
170 170
 	 */
171 171
 	public static function getLevelAll() {
172
-		if(!isset(self::$levelMap[LoggerLevel::ALL])) {
172
+		if (!isset(self::$levelMap[LoggerLevel::ALL])) {
173 173
 			self::$levelMap[LoggerLevel::ALL] = new LoggerLevel(LoggerLevel::ALL, 'ALL', 7);
174 174
 		}
175 175
 		return self::$levelMap[LoggerLevel::ALL];
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 * @static 
226 226
 	 */
227 227
 	public static function toLevel($arg, $defaultLevel = null) {
228
-		if($defaultLevel === null) {
228
+		if ($defaultLevel === null) {
229 229
 			return self::toLevel($arg, self::getLevelDebug());
230 230
 		} else {
231
-			if(is_int($arg)) {
232
-				switch($arg) {
231
+			if (is_int($arg)) {
232
+				switch ($arg) {
233 233
 					case self::ALL:	return self::getLevelAll();
234 234
 					case self::DEBUG: return self::getLevelDebug();
235 235
 					case self::INFO: return self::getLevelInfo();
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 					default: return $defaultLevel;
241 241
 				}
242 242
 			} else {
243
-				switch(strtoupper($arg)) {
243
+				switch (strtoupper($arg)) {
244 244
 					case 'ALL':	return self::getLevelAll();
245 245
 					case 'DEBUG': return self::getLevelDebug();
246 246
 					case 'INFO': return self::getLevelInfo();
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * Defines the minimum set of levels recognized by the system, that is
@@ -33,224 +33,224 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class LoggerLevel {
35 35
 	
36
-	const OFF = 2147483647;
37
-	const FATAL = 50000;
38
-	const ERROR = 40000;
39
-	const WARN = 30000;
40
-	const INFO = 20000;
41
-	const DEBUG = 10000;
42
-	const ALL = -2147483647;
36
+    const OFF = 2147483647;
37
+    const FATAL = 50000;
38
+    const ERROR = 40000;
39
+    const WARN = 30000;
40
+    const INFO = 20000;
41
+    const DEBUG = 10000;
42
+    const ALL = -2147483647;
43 43
 
44
-	/**
45
-	 * TODO: check if still necessary or to be refactored 
46
-	 * @var integer
47
-	 */
48
-	private $level;
44
+    /**
45
+     * TODO: check if still necessary or to be refactored 
46
+     * @var integer
47
+     */
48
+    private $level;
49 49
   
50
-  	/**
51
-   	 * Contains a list of instantiated levels 
52
-   	 */
53
-  	private static $levelMap;
50
+        /**
51
+         * Contains a list of instantiated levels 
52
+         */
53
+        private static $levelMap;
54 54
   	
55
-	/**
56
-	 * @var string
57
-	 */
58
-	private $levelStr;
55
+    /**
56
+     * @var string
57
+     */
58
+    private $levelStr;
59 59
   
60
-	/**
61
-	 * @var integer
62
-	 */
63
-	private $syslogEquivalent;
60
+    /**
61
+     * @var integer
62
+     */
63
+    private $syslogEquivalent;
64 64
 
65
-	/**
66
-	 * Constructor
67
-	 *
68
-	 * @param integer $level
69
-	 * @param string $levelStr
70
-	 * @param integer $syslogEquivalent
71
-	 */
72
-	private function __construct($level, $levelStr, $syslogEquivalent) {
73
-		$this->level = $level;
74
-		$this->levelStr = $levelStr;
75
-		$this->syslogEquivalent = $syslogEquivalent;
76
-	}
65
+    /**
66
+     * Constructor
67
+     *
68
+     * @param integer $level
69
+     * @param string $levelStr
70
+     * @param integer $syslogEquivalent
71
+     */
72
+    private function __construct($level, $levelStr, $syslogEquivalent) {
73
+        $this->level = $level;
74
+        $this->levelStr = $levelStr;
75
+        $this->syslogEquivalent = $syslogEquivalent;
76
+    }
77 77
 
78
-	/**
79
-	 * Two priorities are equal if their level fields are equal.
80
-	 *
81
-	 * @param object $o
82
-	 * @return boolean 
83
-	 */
84
-	public function equals($o) {
85
-		if($o instanceof LoggerLevel) {
86
-			if($this->level == $o->level) {
87
-			    return true;
88
-			}
89
-		} else {
90
-			return false;
91
-		}
92
-	}
78
+    /**
79
+     * Two priorities are equal if their level fields are equal.
80
+     *
81
+     * @param object $o
82
+     * @return boolean 
83
+     */
84
+    public function equals($o) {
85
+        if($o instanceof LoggerLevel) {
86
+            if($this->level == $o->level) {
87
+                return true;
88
+            }
89
+        } else {
90
+            return false;
91
+        }
92
+    }
93 93
 	
94
-	/**
95
-	 * Returns an Off Level
96
-	 * @static
97
-	 * @return LoggerLevel
98
-	 */
99
-	public static function getLevelOff() {
100
-		if(!isset(self::$levelMap[LoggerLevel::OFF])) {
101
-			self::$levelMap[LoggerLevel::OFF] = new LoggerLevel(LoggerLevel::OFF, 'OFF', 0);
102
-		}
103
-		return self::$levelMap[LoggerLevel::OFF];
104
-	}
94
+    /**
95
+     * Returns an Off Level
96
+     * @static
97
+     * @return LoggerLevel
98
+     */
99
+    public static function getLevelOff() {
100
+        if(!isset(self::$levelMap[LoggerLevel::OFF])) {
101
+            self::$levelMap[LoggerLevel::OFF] = new LoggerLevel(LoggerLevel::OFF, 'OFF', 0);
102
+        }
103
+        return self::$levelMap[LoggerLevel::OFF];
104
+    }
105 105
 
106
-	/**
107
-	 * Returns a Fatal Level
108
-	 * @static
109
-	 * @return LoggerLevel
110
-	 */
111
-	public static function getLevelFatal() {
112
-		if(!isset(self::$levelMap[LoggerLevel::FATAL])) {
113
-			self::$levelMap[LoggerLevel::FATAL] = new LoggerLevel(LoggerLevel::FATAL, 'FATAL', 0);
114
-		}
115
-		return self::$levelMap[LoggerLevel::FATAL];
116
-	}
106
+    /**
107
+     * Returns a Fatal Level
108
+     * @static
109
+     * @return LoggerLevel
110
+     */
111
+    public static function getLevelFatal() {
112
+        if(!isset(self::$levelMap[LoggerLevel::FATAL])) {
113
+            self::$levelMap[LoggerLevel::FATAL] = new LoggerLevel(LoggerLevel::FATAL, 'FATAL', 0);
114
+        }
115
+        return self::$levelMap[LoggerLevel::FATAL];
116
+    }
117 117
 	
118
-	/**
119
-	 * Returns an Error Level
120
-	 * @static
121
-	 * @return LoggerLevel
122
-	 */
123
-	public static function getLevelError() {
124
-		if(!isset(self::$levelMap[LoggerLevel::ERROR])) {
125
-			self::$levelMap[LoggerLevel::ERROR] = new LoggerLevel(LoggerLevel::ERROR, 'ERROR', 3);
126
-		}
127
-		return self::$levelMap[LoggerLevel::ERROR];
128
-	}
118
+    /**
119
+     * Returns an Error Level
120
+     * @static
121
+     * @return LoggerLevel
122
+     */
123
+    public static function getLevelError() {
124
+        if(!isset(self::$levelMap[LoggerLevel::ERROR])) {
125
+            self::$levelMap[LoggerLevel::ERROR] = new LoggerLevel(LoggerLevel::ERROR, 'ERROR', 3);
126
+        }
127
+        return self::$levelMap[LoggerLevel::ERROR];
128
+    }
129 129
 	
130
-	/**
131
-	 * Returns a Warn Level
132
-	 * @static
133
-	 * @return LoggerLevel
134
-	 */
135
-	public static function getLevelWarn() {
136
-		if(!isset(self::$levelMap[LoggerLevel::WARN])) {
137
-			self::$levelMap[LoggerLevel::WARN] = new LoggerLevel(LoggerLevel::WARN, 'WARN', 4);
138
-		}
139
-		return self::$levelMap[LoggerLevel::WARN];
140
-	}
130
+    /**
131
+     * Returns a Warn Level
132
+     * @static
133
+     * @return LoggerLevel
134
+     */
135
+    public static function getLevelWarn() {
136
+        if(!isset(self::$levelMap[LoggerLevel::WARN])) {
137
+            self::$levelMap[LoggerLevel::WARN] = new LoggerLevel(LoggerLevel::WARN, 'WARN', 4);
138
+        }
139
+        return self::$levelMap[LoggerLevel::WARN];
140
+    }
141 141
 
142
-	/**
143
-	 * Returns an Info Level
144
-	 * @static
145
-	 * @return LoggerLevel
146
-	 */
147
-	public static function getLevelInfo() {
148
-		if(!isset(self::$levelMap[LoggerLevel::INFO])) {
149
-			self::$levelMap[LoggerLevel::INFO] = new LoggerLevel(LoggerLevel::INFO, 'INFO', 6);
150
-		}
151
-		return self::$levelMap[LoggerLevel::INFO];
152
-	}
142
+    /**
143
+     * Returns an Info Level
144
+     * @static
145
+     * @return LoggerLevel
146
+     */
147
+    public static function getLevelInfo() {
148
+        if(!isset(self::$levelMap[LoggerLevel::INFO])) {
149
+            self::$levelMap[LoggerLevel::INFO] = new LoggerLevel(LoggerLevel::INFO, 'INFO', 6);
150
+        }
151
+        return self::$levelMap[LoggerLevel::INFO];
152
+    }
153 153
 
154
-	/**
155
-	 * Returns a Debug Level
156
-	 * @static
157
-	 * @return LoggerLevel
158
-	 */
159
-	public static function getLevelDebug() {
160
-		if(!isset(self::$levelMap[LoggerLevel::DEBUG])) {
161
-			self::$levelMap[LoggerLevel::DEBUG] = new LoggerLevel(LoggerLevel::DEBUG, 'DEBUG', 7);
162
-		}
163
-		return self::$levelMap[LoggerLevel::DEBUG];
164
-	}
154
+    /**
155
+     * Returns a Debug Level
156
+     * @static
157
+     * @return LoggerLevel
158
+     */
159
+    public static function getLevelDebug() {
160
+        if(!isset(self::$levelMap[LoggerLevel::DEBUG])) {
161
+            self::$levelMap[LoggerLevel::DEBUG] = new LoggerLevel(LoggerLevel::DEBUG, 'DEBUG', 7);
162
+        }
163
+        return self::$levelMap[LoggerLevel::DEBUG];
164
+    }
165 165
 
166
-	/**
167
-	 * Returns an All Level
168
-	 * @static
169
-	 * @return LoggerLevel
170
-	 */
171
-	public static function getLevelAll() {
172
-		if(!isset(self::$levelMap[LoggerLevel::ALL])) {
173
-			self::$levelMap[LoggerLevel::ALL] = new LoggerLevel(LoggerLevel::ALL, 'ALL', 7);
174
-		}
175
-		return self::$levelMap[LoggerLevel::ALL];
176
-	}
166
+    /**
167
+     * Returns an All Level
168
+     * @static
169
+     * @return LoggerLevel
170
+     */
171
+    public static function getLevelAll() {
172
+        if(!isset(self::$levelMap[LoggerLevel::ALL])) {
173
+            self::$levelMap[LoggerLevel::ALL] = new LoggerLevel(LoggerLevel::ALL, 'ALL', 7);
174
+        }
175
+        return self::$levelMap[LoggerLevel::ALL];
176
+    }
177 177
 	
178
-	/**
179
-	 * Return the syslog equivalent of this priority as an integer.
180
-	 * @final
181
-	 * @return integer
182
-	 */
183
-	public function getSyslogEquivalent() {
184
-		return $this->syslogEquivalent;
185
-	}
178
+    /**
179
+     * Return the syslog equivalent of this priority as an integer.
180
+     * @final
181
+     * @return integer
182
+     */
183
+    public function getSyslogEquivalent() {
184
+        return $this->syslogEquivalent;
185
+    }
186 186
 
187
-	/**
188
-	 * Returns <i>true</i> if this level has a higher or equal
189
-	 * level than the level passed as argument, <i>false</i>
190
-	 * otherwise.  
191
-	 * 
192
-	 * <p>You should think twice before overriding the default
193
-	 * implementation of <i>isGreaterOrEqual</i> method.
194
-	 *
195
-	 * @param LoggerLevel $r
196
-	 * @return boolean
197
-	 */
198
-	public function isGreaterOrEqual($r) {
199
-		return $this->level >= $r->level;
200
-	}
187
+    /**
188
+     * Returns <i>true</i> if this level has a higher or equal
189
+     * level than the level passed as argument, <i>false</i>
190
+     * otherwise.  
191
+     * 
192
+     * <p>You should think twice before overriding the default
193
+     * implementation of <i>isGreaterOrEqual</i> method.
194
+     *
195
+     * @param LoggerLevel $r
196
+     * @return boolean
197
+     */
198
+    public function isGreaterOrEqual($r) {
199
+        return $this->level >= $r->level;
200
+    }
201 201
 
202
-	/**
203
-	 * Returns the string representation of this priority.
204
-	 * @return string
205
-	 * @final
206
-	 */
207
-	public function toString() {
208
-		return $this->levelStr;
209
-	}
202
+    /**
203
+     * Returns the string representation of this priority.
204
+     * @return string
205
+     * @final
206
+     */
207
+    public function toString() {
208
+        return $this->levelStr;
209
+    }
210 210
 
211
-	/**
212
-	 * Returns the integer representation of this level.
213
-	 * @return integer
214
-	 */
215
-	public function toInt() {
216
-		return $this->level;
217
-	}
211
+    /**
212
+     * Returns the integer representation of this level.
213
+     * @return integer
214
+     */
215
+    public function toInt() {
216
+        return $this->level;
217
+    }
218 218
 
219
-	/**
220
-	 * Convert the string passed as argument to a level. If the
221
-	 * conversion fails, then this method returns a DEBUG Level.
222
-	 *
223
-	 * @param mixed $arg
224
-	 * @param LoggerLevel $default
225
-	 * @static 
226
-	 */
227
-	public static function toLevel($arg, $defaultLevel = null) {
228
-		if($defaultLevel === null) {
229
-			return self::toLevel($arg, self::getLevelDebug());
230
-		} else {
231
-			if(is_int($arg)) {
232
-				switch($arg) {
233
-					case self::ALL:	return self::getLevelAll();
234
-					case self::DEBUG: return self::getLevelDebug();
235
-					case self::INFO: return self::getLevelInfo();
236
-					case self::WARN: return self::getLevelWarn();
237
-					case self::ERROR: return self::getLevelError();
238
-					case self::FATAL: return self::getLevelFatal();
239
-					case self::OFF:	return self::getLevelOff();
240
-					default: return $defaultLevel;
241
-				}
242
-			} else {
243
-				switch(strtoupper($arg)) {
244
-					case 'ALL':	return self::getLevelAll();
245
-					case 'DEBUG': return self::getLevelDebug();
246
-					case 'INFO': return self::getLevelInfo();
247
-					case 'WARN': return self::getLevelWarn();
248
-					case 'ERROR': return self::getLevelError();
249
-					case 'FATAL': return self::getLevelFatal();
250
-					case 'OFF':	return self::getLevelOff();
251
-					default: return $defaultLevel;
252
-				}
253
-			}
254
-		}
255
-	}
219
+    /**
220
+     * Convert the string passed as argument to a level. If the
221
+     * conversion fails, then this method returns a DEBUG Level.
222
+     *
223
+     * @param mixed $arg
224
+     * @param LoggerLevel $default
225
+     * @static 
226
+     */
227
+    public static function toLevel($arg, $defaultLevel = null) {
228
+        if($defaultLevel === null) {
229
+            return self::toLevel($arg, self::getLevelDebug());
230
+        } else {
231
+            if(is_int($arg)) {
232
+                switch($arg) {
233
+                    case self::ALL:	return self::getLevelAll();
234
+                    case self::DEBUG: return self::getLevelDebug();
235
+                    case self::INFO: return self::getLevelInfo();
236
+                    case self::WARN: return self::getLevelWarn();
237
+                    case self::ERROR: return self::getLevelError();
238
+                    case self::FATAL: return self::getLevelFatal();
239
+                    case self::OFF:	return self::getLevelOff();
240
+                    default: return $defaultLevel;
241
+                }
242
+            } else {
243
+                switch(strtoupper($arg)) {
244
+                    case 'ALL':	return self::getLevelAll();
245
+                    case 'DEBUG': return self::getLevelDebug();
246
+                    case 'INFO': return self::getLevelInfo();
247
+                    case 'WARN': return self::getLevelWarn();
248
+                    case 'ERROR': return self::getLevelError();
249
+                    case 'FATAL': return self::getLevelFatal();
250
+                    case 'OFF':	return self::getLevelOff();
251
+                    default: return $defaultLevel;
252
+                }
253
+            }
254
+        }
255
+    }
256 256
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerLocationInfo.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63 63
 	 *
64 64
 	 * @param array $trace
65
-	 * @param mixed $caller
65
+	 * @param string $fqcn
66 66
 	 */
67 67
 	public function __construct($trace, $fqcn = null) {
68 68
 		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * The internal representation of caller location information.
@@ -26,85 +26,85 @@  discard block
 block discarded – undo
26 26
  * @since 0.3
27 27
  */
28 28
 class LoggerLocationInfo {
29
-	/**
30
-	 * When location information is not available the constant
31
-	 * <i>NA</i> is returned. Current value of this string
32
-	 * constant is <b>?</b>.  
33
-	 */
34
-	const LOCATION_INFO_NA = 'NA';
29
+    /**
30
+     * When location information is not available the constant
31
+     * <i>NA</i> is returned. Current value of this string
32
+     * constant is <b>?</b>.  
33
+     */
34
+    const LOCATION_INFO_NA = 'NA';
35 35
 	
36
-	/**
37
-	* @var string Caller's line number.
38
-	*/
39
-	protected $lineNumber = null;
36
+    /**
37
+     * @var string Caller's line number.
38
+     */
39
+    protected $lineNumber = null;
40 40
 	
41
-	/**
42
-	* @var string Caller's file name.
43
-	*/
44
-	protected $fileName = null;
41
+    /**
42
+     * @var string Caller's file name.
43
+     */
44
+    protected $fileName = null;
45 45
 	
46
-	/**
47
-	* @var string Caller's fully qualified class name.
48
-	*/
49
-	protected $className = null;
46
+    /**
47
+     * @var string Caller's fully qualified class name.
48
+     */
49
+    protected $className = null;
50 50
 	
51
-	/**
52
-	* @var string Caller's method name.
53
-	*/
54
-	protected $methodName = null;
51
+    /**
52
+     * @var string Caller's method name.
53
+     */
54
+    protected $methodName = null;
55 55
 	
56
-	/**
57
-	* @var string 
58
-	*/
59
-	protected $fullInfo = null;
56
+    /**
57
+     * @var string 
58
+     */
59
+    protected $fullInfo = null;
60 60
 
61
-	/**
62
-	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
-	 *
64
-	 * @param array $trace
65
-	 * @param mixed $caller
66
-	 */
67
-	public function __construct($trace, $fqcn = null) {
68
-		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
-		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
-		$this->className = isset($trace['class']) ? $trace['class'] : null;
71
-		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
-		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
-			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
-	}
61
+    /**
62
+     * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
+     *
64
+     * @param array $trace
65
+     * @param mixed $caller
66
+     */
67
+    public function __construct($trace, $fqcn = null) {
68
+        $this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
+        $this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
+        $this->className = isset($trace['class']) ? $trace['class'] : null;
71
+        $this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
+        $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
+            '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
+    }
75 75
 
76
-	public function getClassName() {
77
-		return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
-	}
76
+    public function getClassName() {
77
+        return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
+    }
79 79
 
80
-	/**
81
-	 *	Return the file name of the caller.
82
-	 *	<p>This information is not always available.
83
-	 */
84
-	public function getFileName() {
85
-		return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
-	}
80
+    /**
81
+     *	Return the file name of the caller.
82
+     *	<p>This information is not always available.
83
+     */
84
+    public function getFileName() {
85
+        return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
+    }
87 87
 
88
-	/**
89
-	 *	Returns the line number of the caller.
90
-	 *	<p>This information is not always available.
91
-	 */
92
-	public function getLineNumber() {
93
-		return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
-	}
88
+    /**
89
+     *	Returns the line number of the caller.
90
+     *	<p>This information is not always available.
91
+     */
92
+    public function getLineNumber() {
93
+        return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
+    }
95 95
 
96
-	/**
97
-	 *	Returns the method name of the caller.
98
-	 */
99
-	public function getMethodName() {
100
-		return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
-	}
96
+    /**
97
+     *	Returns the method name of the caller.
98
+     */
99
+    public function getMethodName() {
100
+        return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
+    }
102 102
 
103
-	/**
104
-	 *	Returns the full information of the caller.
105
-	 */
106
-	public function getFullInfo() {
107
-		return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
-	}
103
+    /**
104
+     *	Returns the full information of the caller.
105
+     */
106
+    public function getFullInfo() {
107
+        return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
+    }
109 109
 
110 110
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@
 block discarded – undo
69 69
 		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
70 70
 		$this->className = isset($trace['class']) ? $trace['class'] : null;
71 71
 		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
-		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
-			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
72
+		$this->fullInfo = $this->getClassName().'.'.$this->getMethodName(). 
73
+			'('.$this->getFileName().':'.$this->getLineNumber().')';
74 74
 	}
75 75
 
76 76
 	public function getClassName() {
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerLoggingEvent.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	* LoggerLoggingEvent are filled when actually needed.
118 118
 	*
119 119
 	* @param string $fqcn name of the caller class.
120
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
120
+	* @param Logger $logger The {@link Logger} category of this event or the logger name.
121 121
 	* @param LoggerLevel $priority The level of this event.
122 122
 	* @param mixed $message The message of this event.
123 123
 	* @param integer $timeStamp the timestamp of this logging event.
@@ -249,6 +249,7 @@  discard block
 block discarded – undo
249 249
 	/**
250 250
 	 * Returns the the context corresponding to the <code>key</code>
251 251
 	 * parameter.
252
+	 * @param string $key
252 253
 	 * @return string
253 254
 	 */
254 255
 	public function getMDC($key) {
@@ -304,7 +305,7 @@  discard block
 block discarded – undo
304 305
 	
305 306
 	/**
306 307
 	 * Calculates the time of this event.
307
-	 * @return the time after event starttime when this event has occured
308
+	 * @return string time after event starttime when this event has occured
308 309
 	 */
309 310
 	public function getTime() {
310 311
         $eventTime = (float)$this->getTimeStamp();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	*/
125 125
 	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null) {
126 126
 		$this->fqcn = $fqcn;
127
-		if($logger instanceof Logger) {
127
+		if ($logger instanceof Logger) {
128 128
 			$this->logger = $logger;
129 129
 			$this->categoryName = $logger->getName();
130 130
 		} else {
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 		$this->level = $priority;
134 134
 		$this->message = $message;
135
-		if($timeStamp !== null && is_float($timeStamp)) {
135
+		if ($timeStamp !== null && is_float($timeStamp)) {
136 136
 			$this->timeStamp = $timeStamp;
137 137
 		} else {
138
-			if(function_exists('microtime')) {
138
+			if (function_exists('microtime')) {
139 139
 				// get microtime as float
140 140
 				$this->timeStamp = microtime(true);
141 141
 			} else {
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
 	 * @return LoggerLocationInfo
155 155
 	 */
156 156
 	public function getLocationInformation() {
157
-		if($this->locationInfo === null) {
157
+		if ($this->locationInfo === null) {
158 158
 
159 159
 			$locationInfo = array();
160 160
 
161
-			if(function_exists('debug_backtrace')) {
161
+			if (function_exists('debug_backtrace')) {
162 162
 				$trace = debug_backtrace();
163 163
 				$prevHop = null;
164 164
 				// make a downsearch to identify the caller
165 165
 				$hop = array_pop($trace);
166
-				while($hop !== null) {
167
-					if(isset($hop['class'])) {
166
+				while ($hop !== null) {
167
+					if (isset($hop['class'])) {
168 168
 						// we are sometimes in functions = no class available: avoid php warning here
169 169
 						$className = strtolower($hop['class']);
170
-						if(!empty($className) and ($className == 'logger' or $className == 'loggercategory' or 
170
+						if (!empty($className) and ($className == 'logger' or $className == 'loggercategory' or 
171 171
 							strtolower(get_parent_class($className)) == 'logger' or
172 172
 							strtolower(get_parent_class($className)) == 'loggercategory')) {
173 173
 							$locationInfo['line'] = $hop['line'];
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 					$hop = array_pop($trace);
180 180
 				}
181 181
 				$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
182
-				if(isset($prevHop['function']) and
182
+				if (isset($prevHop['function']) and
183 183
 					$prevHop['function'] !== 'include' and
184 184
 					$prevHop['function'] !== 'include_once' and
185 185
 					$prevHop['function'] !== 'require' and
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 * @return mixed
225 225
 	 */
226 226
 	public function getMessage() {
227
-		if($this->message !== null) {
227
+		if ($this->message !== null) {
228 228
 			return $this->message;
229 229
 		} else {
230 230
 			return $this->getRenderedMessage();
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @return string  
240 240
 	 */
241 241
 	public function getNDC() {
242
-		if($this->ndcLookupRequired) {
242
+		if ($this->ndcLookupRequired) {
243 243
 			$this->ndcLookupRequired = false;
244 244
 			$this->ndc = implode(' ', LoggerNDC::get());
245 245
 		}
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @return string
261 261
 	 */
262 262
 	public function getRenderedMessage() {
263
-		if($this->renderedMessage === null and $this->message !== null) {
264
-			if(is_string($this->message)) {
263
+		if ($this->renderedMessage === null and $this->message !== null) {
264
+			if (is_string($this->message)) {
265 265
 					$this->renderedMessage = $this->message;
266 266
 			} else {
267 267
 			    // $this->logger might be null or an instance of Logger or RootLogger
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			    // TODO: Logger::getHierarchy() is marked @deprecated!
271 271
 				$repository = Logger::getHierarchy();
272 272
 				$rendererMap = $repository->getRendererMap();
273
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
273
+				$this->renderedMessage = $rendererMap->findAndRender($this->message);
274 274
 			}
275 275
 		}
276 276
 		return $this->renderedMessage;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @static
285 285
 	 */
286 286
 	public static function getStartTime() {
287
-		if(!isset(self::$startTime)) {
287
+		if (!isset(self::$startTime)) {
288 288
 			if (function_exists('microtime')) {
289 289
 				// microtime as float
290 290
 				self::$startTime = microtime(true);
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * @return the time after event starttime when this event has occured
308 308
 	 */
309 309
 	public function getTime() {
310
-        $eventTime = (float)$this->getTimeStamp();
311
-        $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
310
+        $eventTime = (float) $this->getTimeStamp();
311
+        $eventStartTime = (float) LoggerLoggingEvent::getStartTime();
312 312
         return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
313 313
     }
314 314
 	
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function getThreadName() {
319 319
 		if ($this->threadName === null) {
320
-			$this->threadName = (string)getmypid();
320
+			$this->threadName = (string) getmypid();
321 321
 		}
322 322
 		return $this->threadName;
323 323
 	}
Please login to merge, or discard this patch.
Indentation   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -26,334 +26,334 @@
 block discarded – undo
26 26
  */
27 27
 class LoggerLoggingEvent {
28 28
 
29
-	private static $startTime;
29
+    private static $startTime;
30 30
 
31
-	/** 
32
-	* @var string Fully Qualified Class Name of the calling category class.
33
-	*/
34
-	private $fqcn;
31
+    /** 
32
+     * @var string Fully Qualified Class Name of the calling category class.
33
+     */
34
+    private $fqcn;
35 35
 	
36
-	/**
37
-	* @var Logger reference
38
-	*/
39
-	private $logger = null;
36
+    /**
37
+     * @var Logger reference
38
+     */
39
+    private $logger = null;
40 40
 	
41
-	/** 
42
-	* The category (logger) name.
43
-	* This field will be marked as private in future
44
-	* releases. Please do not access it directly. 
45
-	* Use the {@link getLoggerName()} method instead.
46
-	* @deprecated 
47
-	*/
48
-	private $categoryName;
41
+    /** 
42
+     * The category (logger) name.
43
+     * This field will be marked as private in future
44
+     * releases. Please do not access it directly. 
45
+     * Use the {@link getLoggerName()} method instead.
46
+     * @deprecated 
47
+     */
48
+    private $categoryName;
49 49
 	
50
-	/** 
51
-	* Level of logging event.
52
-	* <p> This field should not be accessed directly. You shoud use the
53
-	* {@link getLevel()} method instead.
54
-	*
55
-	* @deprecated
56
-	* @var LoggerLevel
57
-	*/
58
-	protected $level;
50
+    /** 
51
+     * Level of logging event.
52
+     * <p> This field should not be accessed directly. You shoud use the
53
+     * {@link getLevel()} method instead.
54
+     *
55
+     * @deprecated
56
+     * @var LoggerLevel
57
+     */
58
+    protected $level;
59 59
 	
60
-	/** 
61
-	 * @var string The nested diagnostic context (NDC) of logging event. 
62
-	 */
63
-	private $ndc;
60
+    /** 
61
+     * @var string The nested diagnostic context (NDC) of logging event. 
62
+     */
63
+    private $ndc;
64 64
 	
65
-	/** 
66
-	 * Have we tried to do an NDC lookup? If we did, there is no need
67
-	 * to do it again.	Note that its value is always false when
68
-	 * serialized. Thus, a receiving SocketNode will never use it's own
69
-	 * (incorrect) NDC. See also writeObject method.
70
-	 * @var boolean
71
-	 */
72
-	private $ndcLookupRequired = true;
65
+    /** 
66
+     * Have we tried to do an NDC lookup? If we did, there is no need
67
+     * to do it again.	Note that its value is always false when
68
+     * serialized. Thus, a receiving SocketNode will never use it's own
69
+     * (incorrect) NDC. See also writeObject method.
70
+     * @var boolean
71
+     */
72
+    private $ndcLookupRequired = true;
73 73
 	
74
-	/** 
75
-	 * Have we tried to do an MDC lookup? If we did, there is no need
76
-	 * to do it again.	Note that its value is always false when
77
-	 * serialized. See also the getMDC and getMDCCopy methods.
78
-	 * @var boolean	 
79
-	 */
80
-	private $mdcCopyLookupRequired = true;
74
+    /** 
75
+     * Have we tried to do an MDC lookup? If we did, there is no need
76
+     * to do it again.	Note that its value is always false when
77
+     * serialized. See also the getMDC and getMDCCopy methods.
78
+     * @var boolean	 
79
+     */
80
+    private $mdcCopyLookupRequired = true;
81 81
 	
82
-	/** 
83
-	 * @var mixed The application supplied message of logging event. 
84
-	 */
85
-	private $message;
82
+    /** 
83
+     * @var mixed The application supplied message of logging event. 
84
+     */
85
+    private $message;
86 86
 	
87
-	/** 
88
-	 * The application supplied message rendered through the log4php
89
-	 * objet rendering mechanism. At present renderedMessage == message.
90
-	 * @var string
91
-	 */
92
-	private $renderedMessage = null;
87
+    /** 
88
+     * The application supplied message rendered through the log4php
89
+     * objet rendering mechanism. At present renderedMessage == message.
90
+     * @var string
91
+     */
92
+    private $renderedMessage = null;
93 93
 	
94
-	/** 
95
-	 * The name of thread in which this logging event was generated.
96
-	 * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
97
-	 * @var mixed
98
-	 */
99
-	private $threadName = null;
94
+    /** 
95
+     * The name of thread in which this logging event was generated.
96
+     * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
97
+     * @var mixed
98
+     */
99
+    private $threadName = null;
100 100
 	
101
-	/** 
102
-	* The number of seconds elapsed from 1/1/1970 until logging event
103
-	* was created plus microseconds if available.
104
-	* @var float
105
-	*/
106
-	public $timeStamp;
101
+    /** 
102
+     * The number of seconds elapsed from 1/1/1970 until logging event
103
+     * was created plus microseconds if available.
104
+     * @var float
105
+     */
106
+    public $timeStamp;
107 107
 	
108
-	/** 
109
-	* @var LoggerLocationInfo Location information for the caller. 
110
-	*/
111
-	private $locationInfo = null;
108
+    /** 
109
+     * @var LoggerLocationInfo Location information for the caller. 
110
+     */
111
+    private $locationInfo = null;
112 112
 	
113
-	/**
114
-	* Instantiate a LoggingEvent from the supplied parameters.
115
-	*
116
-	* <p>Except {@link $timeStamp} all the other fields of
117
-	* LoggerLoggingEvent are filled when actually needed.
118
-	*
119
-	* @param string $fqcn name of the caller class.
120
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
121
-	* @param LoggerLevel $priority The level of this event.
122
-	* @param mixed $message The message of this event.
123
-	* @param integer $timeStamp the timestamp of this logging event.
124
-	*/
125
-	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null) {
126
-		$this->fqcn = $fqcn;
127
-		if($logger instanceof Logger) {
128
-			$this->logger = $logger;
129
-			$this->categoryName = $logger->getName();
130
-		} else {
131
-			$this->categoryName = strval($logger);
132
-		}
133
-		$this->level = $priority;
134
-		$this->message = $message;
135
-		if($timeStamp !== null && is_float($timeStamp)) {
136
-			$this->timeStamp = $timeStamp;
137
-		} else {
138
-			if(function_exists('microtime')) {
139
-				// get microtime as float
140
-				$this->timeStamp = microtime(true);
141
-			} else {
142
-				$this->timeStamp = floatval(time());
143
-			}
144
-		}
145
-	}
113
+    /**
114
+     * Instantiate a LoggingEvent from the supplied parameters.
115
+     *
116
+     * <p>Except {@link $timeStamp} all the other fields of
117
+     * LoggerLoggingEvent are filled when actually needed.
118
+     *
119
+     * @param string $fqcn name of the caller class.
120
+     * @param mixed $logger The {@link Logger} category of this event or the logger name.
121
+     * @param LoggerLevel $priority The level of this event.
122
+     * @param mixed $message The message of this event.
123
+     * @param integer $timeStamp the timestamp of this logging event.
124
+     */
125
+    public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null) {
126
+        $this->fqcn = $fqcn;
127
+        if($logger instanceof Logger) {
128
+            $this->logger = $logger;
129
+            $this->categoryName = $logger->getName();
130
+        } else {
131
+            $this->categoryName = strval($logger);
132
+        }
133
+        $this->level = $priority;
134
+        $this->message = $message;
135
+        if($timeStamp !== null && is_float($timeStamp)) {
136
+            $this->timeStamp = $timeStamp;
137
+        } else {
138
+            if(function_exists('microtime')) {
139
+                // get microtime as float
140
+                $this->timeStamp = microtime(true);
141
+            } else {
142
+                $this->timeStamp = floatval(time());
143
+            }
144
+        }
145
+    }
146 146
 
147
-	/**
148
-	 * Set the location information for this logging event. The collected
149
-	 * information is cached for future use.
150
-	 *
151
-	 * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
152
-	 * to collect informations about caller.</p>
153
-	 * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
154
-	 * @return LoggerLocationInfo
155
-	 */
156
-	public function getLocationInformation() {
157
-		if($this->locationInfo === null) {
147
+    /**
148
+     * Set the location information for this logging event. The collected
149
+     * information is cached for future use.
150
+     *
151
+     * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
152
+     * to collect informations about caller.</p>
153
+     * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
154
+     * @return LoggerLocationInfo
155
+     */
156
+    public function getLocationInformation() {
157
+        if($this->locationInfo === null) {
158 158
 
159
-			$locationInfo = array();
159
+            $locationInfo = array();
160 160
 
161
-			if(function_exists('debug_backtrace')) {
162
-				$trace = debug_backtrace();
163
-				$prevHop = null;
164
-				// make a downsearch to identify the caller
165
-				$hop = array_pop($trace);
166
-				while($hop !== null) {
167
-					if(isset($hop['class'])) {
168
-						// we are sometimes in functions = no class available: avoid php warning here
169
-						$className = strtolower($hop['class']);
170
-						if(!empty($className) and ($className == 'logger' or $className == 'loggercategory' or 
171
-							strtolower(get_parent_class($className)) == 'logger' or
172
-							strtolower(get_parent_class($className)) == 'loggercategory')) {
173
-							$locationInfo['line'] = $hop['line'];
174
-							$locationInfo['file'] = $hop['file'];
175
-							break;
176
-						}
177
-					}
178
-					$prevHop = $hop;
179
-					$hop = array_pop($trace);
180
-				}
181
-				$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
182
-				if(isset($prevHop['function']) and
183
-					$prevHop['function'] !== 'include' and
184
-					$prevHop['function'] !== 'include_once' and
185
-					$prevHop['function'] !== 'require' and
186
-					$prevHop['function'] !== 'require_once') {
161
+            if(function_exists('debug_backtrace')) {
162
+                $trace = debug_backtrace();
163
+                $prevHop = null;
164
+                // make a downsearch to identify the caller
165
+                $hop = array_pop($trace);
166
+                while($hop !== null) {
167
+                    if(isset($hop['class'])) {
168
+                        // we are sometimes in functions = no class available: avoid php warning here
169
+                        $className = strtolower($hop['class']);
170
+                        if(!empty($className) and ($className == 'logger' or $className == 'loggercategory' or 
171
+                            strtolower(get_parent_class($className)) == 'logger' or
172
+                            strtolower(get_parent_class($className)) == 'loggercategory')) {
173
+                            $locationInfo['line'] = $hop['line'];
174
+                            $locationInfo['file'] = $hop['file'];
175
+                            break;
176
+                        }
177
+                    }
178
+                    $prevHop = $hop;
179
+                    $hop = array_pop($trace);
180
+                }
181
+                $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
182
+                if(isset($prevHop['function']) and
183
+                    $prevHop['function'] !== 'include' and
184
+                    $prevHop['function'] !== 'include_once' and
185
+                    $prevHop['function'] !== 'require' and
186
+                    $prevHop['function'] !== 'require_once') {
187 187
 	
188
-					$locationInfo['function'] = $prevHop['function'];
189
-				} else {
190
-					$locationInfo['function'] = 'main';
191
-				}
192
-			}
188
+                    $locationInfo['function'] = $prevHop['function'];
189
+                } else {
190
+                    $locationInfo['function'] = 'main';
191
+                }
192
+            }
193 193
 					 
194
-			$this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn);
195
-		}
196
-		return $this->locationInfo;
197
-	}
194
+            $this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn);
195
+        }
196
+        return $this->locationInfo;
197
+    }
198 198
 
199
-	/**
200
-	 * Return the level of this event. Use this form instead of directly
201
-	 * accessing the {@link $level} field.
202
-	 * @return LoggerLevel	
203
-	 */
204
-	public function getLevel() {
205
-		return $this->level;
206
-	}
199
+    /**
200
+     * Return the level of this event. Use this form instead of directly
201
+     * accessing the {@link $level} field.
202
+     * @return LoggerLevel	
203
+     */
204
+    public function getLevel() {
205
+        return $this->level;
206
+    }
207 207
 
208
-	/**
209
-	 * Return the name of the logger. Use this form instead of directly
210
-	 * accessing the {@link $categoryName} field.
211
-	 * @return string  
212
-	 */
213
-	public function getLoggerName() {
214
-		return $this->categoryName;
215
-	}
208
+    /**
209
+     * Return the name of the logger. Use this form instead of directly
210
+     * accessing the {@link $categoryName} field.
211
+     * @return string  
212
+     */
213
+    public function getLoggerName() {
214
+        return $this->categoryName;
215
+    }
216 216
 
217
-	/**
218
-	 * Return the message for this logging event.
219
-	 *
220
-	 * <p>Before serialization, the returned object is the message
221
-	 * passed by the user to generate the logging event. After
222
-	 * serialization, the returned value equals the String form of the
223
-	 * message possibly after object rendering.
224
-	 * @return mixed
225
-	 */
226
-	public function getMessage() {
227
-		if($this->message !== null) {
228
-			return $this->message;
229
-		} else {
230
-			return $this->getRenderedMessage();
231
-		}
232
-	}
217
+    /**
218
+     * Return the message for this logging event.
219
+     *
220
+     * <p>Before serialization, the returned object is the message
221
+     * passed by the user to generate the logging event. After
222
+     * serialization, the returned value equals the String form of the
223
+     * message possibly after object rendering.
224
+     * @return mixed
225
+     */
226
+    public function getMessage() {
227
+        if($this->message !== null) {
228
+            return $this->message;
229
+        } else {
230
+            return $this->getRenderedMessage();
231
+        }
232
+    }
233 233
 
234
-	/**
235
-	 * This method returns the NDC for this event. It will return the
236
-	 * correct content even if the event was generated in a different
237
-	 * thread or even on a different machine. The {@link LoggerNDC::get()} method
238
-	 * should <b>never</b> be called directly.
239
-	 * @return string  
240
-	 */
241
-	public function getNDC() {
242
-		if($this->ndcLookupRequired) {
243
-			$this->ndcLookupRequired = false;
244
-			$this->ndc = implode(' ', LoggerNDC::get());
245
-		}
246
-		return $this->ndc;
247
-	}
234
+    /**
235
+     * This method returns the NDC for this event. It will return the
236
+     * correct content even if the event was generated in a different
237
+     * thread or even on a different machine. The {@link LoggerNDC::get()} method
238
+     * should <b>never</b> be called directly.
239
+     * @return string  
240
+     */
241
+    public function getNDC() {
242
+        if($this->ndcLookupRequired) {
243
+            $this->ndcLookupRequired = false;
244
+            $this->ndc = implode(' ', LoggerNDC::get());
245
+        }
246
+        return $this->ndc;
247
+    }
248 248
 
249
-	/**
250
-	 * Returns the the context corresponding to the <code>key</code>
251
-	 * parameter.
252
-	 * @return string
253
-	 */
254
-	public function getMDC($key) {
255
-		return LoggerMDC::get($key);
256
-	}
249
+    /**
250
+     * Returns the the context corresponding to the <code>key</code>
251
+     * parameter.
252
+     * @return string
253
+     */
254
+    public function getMDC($key) {
255
+        return LoggerMDC::get($key);
256
+    }
257 257
 
258
-	/**
259
-	 * Render message.
260
-	 * @return string
261
-	 */
262
-	public function getRenderedMessage() {
263
-		if($this->renderedMessage === null and $this->message !== null) {
264
-			if(is_string($this->message)) {
265
-					$this->renderedMessage = $this->message;
266
-			} else {
267
-			    // $this->logger might be null or an instance of Logger or RootLogger
268
-			    // But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
269
-			    // no need figure out which one is $this->logger part of.
270
-			    // TODO: Logger::getHierarchy() is marked @deprecated!
271
-				$repository = Logger::getHierarchy();
272
-				$rendererMap = $repository->getRendererMap();
273
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
274
-			}
275
-		}
276
-		return $this->renderedMessage;
277
-	}
258
+    /**
259
+     * Render message.
260
+     * @return string
261
+     */
262
+    public function getRenderedMessage() {
263
+        if($this->renderedMessage === null and $this->message !== null) {
264
+            if(is_string($this->message)) {
265
+                    $this->renderedMessage = $this->message;
266
+            } else {
267
+                // $this->logger might be null or an instance of Logger or RootLogger
268
+                // But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
269
+                // no need figure out which one is $this->logger part of.
270
+                // TODO: Logger::getHierarchy() is marked @deprecated!
271
+                $repository = Logger::getHierarchy();
272
+                $rendererMap = $repository->getRendererMap();
273
+                $this->renderedMessage= $rendererMap->findAndRender($this->message);
274
+            }
275
+        }
276
+        return $this->renderedMessage;
277
+    }
278 278
 
279
-	/**
280
-	 * Returns the time when the application started, in seconds
281
-	 * elapsed since 01.01.1970 plus microseconds if available.
282
-	 *
283
-	 * @return float
284
-	 * @static
285
-	 */
286
-	public static function getStartTime() {
287
-		if(!isset(self::$startTime)) {
288
-			if (function_exists('microtime')) {
289
-				// microtime as float
290
-				self::$startTime = microtime(true);
291
-			} else {
292
-				self::$startTime = floatval(time());
293
-			}
294
-		}
295
-		return self::$startTime; 
296
-	}
279
+    /**
280
+     * Returns the time when the application started, in seconds
281
+     * elapsed since 01.01.1970 plus microseconds if available.
282
+     *
283
+     * @return float
284
+     * @static
285
+     */
286
+    public static function getStartTime() {
287
+        if(!isset(self::$startTime)) {
288
+            if (function_exists('microtime')) {
289
+                // microtime as float
290
+                self::$startTime = microtime(true);
291
+            } else {
292
+                self::$startTime = floatval(time());
293
+            }
294
+        }
295
+        return self::$startTime; 
296
+    }
297 297
 
298
-	/**
299
-	 * @return float
300
-	 */
301
-	public function getTimeStamp() {
302
-		return $this->timeStamp;
303
-	}
298
+    /**
299
+     * @return float
300
+     */
301
+    public function getTimeStamp() {
302
+        return $this->timeStamp;
303
+    }
304 304
 	
305
-	/**
306
-	 * Calculates the time of this event.
307
-	 * @return the time after event starttime when this event has occured
308
-	 */
309
-	public function getTime() {
305
+    /**
306
+     * Calculates the time of this event.
307
+     * @return the time after event starttime when this event has occured
308
+     */
309
+    public function getTime() {
310 310
         $eventTime = (float)$this->getTimeStamp();
311 311
         $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
312 312
         return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
313 313
     }
314 314
 	
315
-	/**
316
-	 * @return mixed
317
-	 */
318
-	public function getThreadName() {
319
-		if ($this->threadName === null) {
320
-			$this->threadName = (string)getmypid();
321
-		}
322
-		return $this->threadName;
323
-	}
315
+    /**
316
+     * @return mixed
317
+     */
318
+    public function getThreadName() {
319
+        if ($this->threadName === null) {
320
+            $this->threadName = (string)getmypid();
321
+        }
322
+        return $this->threadName;
323
+    }
324 324
 
325
-	/**
326
-	 * @return mixed null
327
-	 */
328
-	public function getThrowableInformation() {
329
-		return null;
330
-	}
325
+    /**
326
+     * @return mixed null
327
+     */
328
+    public function getThrowableInformation() {
329
+        return null;
330
+    }
331 331
 	
332
-	/**
333
-	 * Serialize this object
334
-	 * @return string
335
-	 */
336
-	public function toString() {
337
-		serialize($this);
338
-	}
332
+    /**
333
+     * Serialize this object
334
+     * @return string
335
+     */
336
+    public function toString() {
337
+        serialize($this);
338
+    }
339 339
 	
340
-	/**
341
-	 * Avoid serialization of the {@link $logger} object
342
-	 */
343
-	public function __sleep() {
344
-		return array(
345
-			'fqcn',
346
-			'categoryName',
347
-			'level',
348
-			'ndc',
349
-			'ndcLookupRequired',
350
-			'message',
351
-			'renderedMessage',
352
-			'threadName',
353
-			'timeStamp',
354
-			'locationInfo',
355
-		);
356
-	}
340
+    /**
341
+     * Avoid serialization of the {@link $logger} object
342
+     */
343
+    public function __sleep() {
344
+        return array(
345
+            'fqcn',
346
+            'categoryName',
347
+            'level',
348
+            'ndc',
349
+            'ndcLookupRequired',
350
+            'message',
351
+            'renderedMessage',
352
+            'threadName',
353
+            'timeStamp',
354
+            'locationInfo',
355
+        );
356
+    }
357 357
 
358 358
 }
359 359
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerReflectionUtils.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,6 +47,10 @@  discard block
 block discarded – undo
47 47
 	 * @static
48 48
 	 */
49 49
 	 // TODO: check, if this is really useful
50
+
51
+	/**
52
+	 * @param string $prefix
53
+	 */
50 54
 	public static function setPropertiesByObject($obj, $properties, $prefix) {
51 55
 		$pSetter = new LoggerReflectionUtils($obj);
52 56
 		return $pSetter->setProperties($properties, $prefix);
@@ -123,7 +127,7 @@  discard block
 block discarded – undo
123 127
 	/**
124 128
 	 * Creates an instances from the given class name.
125 129
 	 *
126
-	 * @param string $classname
130
+	 * @param string $class
127 131
 	 * @return an object from the class with the given classname
128 132
 	 */
129 133
 	public static function createObject($class) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	 // TODO: check, if this is really useful
70 70
 	public function setProperties($properties, $prefix) {
71 71
 		$len = strlen($prefix);
72
-		while(list($key,) = each($properties)) {
73
-			if(strpos($key, $prefix) === 0) {
74
-				if(strpos($key, '.', ($len + 1)) > 0) {
72
+		while (list($key,) = each($properties)) {
73
+			if (strpos($key, $prefix) === 0) {
74
+				if (strpos($key, '.', ($len + 1)) > 0) {
75 75
 					continue;
76 76
 				}
77 77
 				$value = LoggerOptionConverter::findAndSubst($key, $properties);
78 78
 				$key = substr($key, $len);
79
-				if($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
79
+				if ($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
80 80
 					continue;
81 81
 				}
82 82
 				$this->setProperty($key, $value);
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 	 * @param string $value	  String value of the property
102 102
 	 */
103 103
 	public function setProperty($name, $value) {
104
-		if($value === null) {
104
+		if ($value === null) {
105 105
 			return;
106 106
 		}
107 107
 		
108
-		$method = "set" . ucfirst($name);
108
+		$method = "set".ucfirst($name);
109 109
 		
110
-		if(!method_exists($this->obj, $method)) {
110
+		if (!method_exists($this->obj, $method)) {
111 111
 			throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
112 112
 		} else {
113 113
 			return call_user_func(array($this->obj, $method), $value);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	}
116 116
   
117 117
 	public function activate() {
118
-		if(method_exists($this->obj, 'activateoptions')) {
118
+		if (method_exists($this->obj, 'activateoptions')) {
119 119
 			return call_user_func(array($this->obj, 'activateoptions'));
120 120
 		} 
121 121
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return an object from the class with the given classname
128 128
 	 */
129 129
 	public static function createObject($class) {
130
-		if(!empty($class)) {
130
+		if (!empty($class)) {
131 131
 			$class = basename($class);
132 132
 			return new $class();
133 133
 		}
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- * 
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     * 
18
+     * @package log4php
19
+     */
20 20
  
21
- /**
22
-  * Provides methods for reflective use on php objects
23
-  * @package log4php
24
-  */
21
+    /**
22
+     * Provides methods for reflective use on php objects
23
+     * @package log4php
24
+     */
25 25
 class LoggerReflectionUtils {
26
-		/** the target object */
27
-	private $obj;
26
+        /** the target object */
27
+    private $obj;
28 28
   
29
-	/**
30
-	 * Create a new LoggerReflectionUtils for the specified Object. 
31
-	 * This is done in prepartion for invoking {@link setProperty()} 
32
-	 * one or more times.
33
-	 * @param object &$obj the object for which to set properties
34
-	 */
35
-	public function __construct($obj) {
36
-		$this->obj = $obj;
37
-	}
29
+    /**
30
+     * Create a new LoggerReflectionUtils for the specified Object. 
31
+     * This is done in prepartion for invoking {@link setProperty()} 
32
+     * one or more times.
33
+     * @param object &$obj the object for which to set properties
34
+     */
35
+    public function __construct($obj) {
36
+        $this->obj = $obj;
37
+    }
38 38
   
39
-	/**
40
-	 * Set the properties of an object passed as a parameter in one
41
-	 * go. The <code>properties</code> are parsed relative to a
42
-	 * <code>prefix</code>.
43
-	 *
44
-	 * @param object $obj The object to configure.
45
-	 * @param array $properties An array containing keys and values.
46
-	 * @param string $prefix Only keys having the specified prefix will be set.
47
-	 * @static
48
-	 */
49
-	 // TODO: check, if this is really useful
50
-	public static function setPropertiesByObject($obj, $properties, $prefix) {
51
-		$pSetter = new LoggerReflectionUtils($obj);
52
-		return $pSetter->setProperties($properties, $prefix);
53
-	}
39
+    /**
40
+     * Set the properties of an object passed as a parameter in one
41
+     * go. The <code>properties</code> are parsed relative to a
42
+     * <code>prefix</code>.
43
+     *
44
+     * @param object $obj The object to configure.
45
+     * @param array $properties An array containing keys and values.
46
+     * @param string $prefix Only keys having the specified prefix will be set.
47
+     * @static
48
+     */
49
+        // TODO: check, if this is really useful
50
+    public static function setPropertiesByObject($obj, $properties, $prefix) {
51
+        $pSetter = new LoggerReflectionUtils($obj);
52
+        return $pSetter->setProperties($properties, $prefix);
53
+    }
54 54
   
55 55
 
56
-	/**
57
-	 * Set the properites for the object that match the
58
-	 * <code>prefix</code> passed as parameter.
59
-	 * 
60
-	 * Example:
61
-	 * 
62
-	 * $arr['xxxname'] = 'Joe';
63
- 	 * $arr['xxxmale'] = true;
64
-	 * and prefix xxx causes setName and setMale.	
65
-	 *
66
-	 * @param array $properties An array containing keys and values.
67
-	 * @param string $prefix Only keys having the specified prefix will be set.
68
-	 */
69
-	 // TODO: check, if this is really useful
70
-	public function setProperties($properties, $prefix) {
71
-		$len = strlen($prefix);
72
-		while(list($key,) = each($properties)) {
73
-			if(strpos($key, $prefix) === 0) {
74
-				if(strpos($key, '.', ($len + 1)) > 0) {
75
-					continue;
76
-				}
77
-				$value = LoggerOptionConverter::findAndSubst($key, $properties);
78
-				$key = substr($key, $len);
79
-				if($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
80
-					continue;
81
-				}
82
-				$this->setProperty($key, $value);
83
-			}
84
-		}
85
-		$this->activate();
86
-	}
56
+    /**
57
+     * Set the properites for the object that match the
58
+     * <code>prefix</code> passed as parameter.
59
+     * 
60
+     * Example:
61
+     * 
62
+     * $arr['xxxname'] = 'Joe';
63
+     * $arr['xxxmale'] = true;
64
+     * and prefix xxx causes setName and setMale.	
65
+     *
66
+     * @param array $properties An array containing keys and values.
67
+     * @param string $prefix Only keys having the specified prefix will be set.
68
+     */
69
+        // TODO: check, if this is really useful
70
+    public function setProperties($properties, $prefix) {
71
+        $len = strlen($prefix);
72
+        while(list($key,) = each($properties)) {
73
+            if(strpos($key, $prefix) === 0) {
74
+                if(strpos($key, '.', ($len + 1)) > 0) {
75
+                    continue;
76
+                }
77
+                $value = LoggerOptionConverter::findAndSubst($key, $properties);
78
+                $key = substr($key, $len);
79
+                if($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
80
+                    continue;
81
+                }
82
+                $this->setProperty($key, $value);
83
+            }
84
+        }
85
+        $this->activate();
86
+    }
87 87
 	
88
-	/**
89
-	 * Set a property on this PropertySetter's Object. If successful, this
90
-	 * method will invoke a setter method on the underlying Object. The
91
-	 * setter is the one for the specified property name and the value is
92
-	 * determined partly from the setter argument type and partly from the
93
-	 * value specified in the call to this method.
94
-	 *
95
-	 * <p>If the setter expects a String no conversion is necessary.
96
-	 * If it expects an int, then an attempt is made to convert 'value'
97
-	 * to an int using new Integer(value). If the setter expects a boolean,
98
-	 * the conversion is by new Boolean(value).
99
-	 *
100
-	 * @param string $name	  name of the property
101
-	 * @param string $value	  String value of the property
102
-	 */
103
-	public function setProperty($name, $value) {
104
-		if($value === null) {
105
-			return;
106
-		}
88
+    /**
89
+     * Set a property on this PropertySetter's Object. If successful, this
90
+     * method will invoke a setter method on the underlying Object. The
91
+     * setter is the one for the specified property name and the value is
92
+     * determined partly from the setter argument type and partly from the
93
+     * value specified in the call to this method.
94
+     *
95
+     * <p>If the setter expects a String no conversion is necessary.
96
+     * If it expects an int, then an attempt is made to convert 'value'
97
+     * to an int using new Integer(value). If the setter expects a boolean,
98
+     * the conversion is by new Boolean(value).
99
+     *
100
+     * @param string $name	  name of the property
101
+     * @param string $value	  String value of the property
102
+     */
103
+    public function setProperty($name, $value) {
104
+        if($value === null) {
105
+            return;
106
+        }
107 107
 		
108
-		$method = "set" . ucfirst($name);
108
+        $method = "set" . ucfirst($name);
109 109
 		
110
-		if(!method_exists($this->obj, $method)) {
111
-			throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
112
-		} else {
113
-			return call_user_func(array($this->obj, $method), $value);
114
-		} 
115
-	}
110
+        if(!method_exists($this->obj, $method)) {
111
+            throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
112
+        } else {
113
+            return call_user_func(array($this->obj, $method), $value);
114
+        } 
115
+    }
116 116
   
117
-	public function activate() {
118
-		if(method_exists($this->obj, 'activateoptions')) {
119
-			return call_user_func(array($this->obj, 'activateoptions'));
120
-		} 
121
-	}
117
+    public function activate() {
118
+        if(method_exists($this->obj, 'activateoptions')) {
119
+            return call_user_func(array($this->obj, 'activateoptions'));
120
+        } 
121
+    }
122 122
 	
123
-	/**
124
-	 * Creates an instances from the given class name.
125
-	 *
126
-	 * @param string $classname
127
-	 * @return an object from the class with the given classname
128
-	 */
129
-	public static function createObject($class) {
130
-		if(!empty($class)) {
131
-			$class = basename($class);
132
-			return new $class();
133
-		}
134
-		return null;
135
-	}
123
+    /**
124
+     * Creates an instances from the given class name.
125
+     *
126
+     * @param string $classname
127
+     * @return an object from the class with the given classname
128
+     */
129
+    public static function createObject($class) {
130
+        if(!empty($class)) {
131
+            $class = basename($class);
132
+            return new $class();
133
+        }
134
+        return null;
135
+    }
136 136
 	
137
-	/**
137
+    /**
138 138
      * @param object $object
139 139
      * @param string $name
140 140
      * @param mixed $value
Please login to merge, or discard this patch.