Passed
Push — 1.10.x ( f75118...849f97 )
by Angel Fernando Quiroz
52:16
created
main/inc/lib/phpdocx/lib/log4php/appenders/LoggerAppenderRollingFile.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
    	
93 93
 	/**
94 94
 	 * Returns the value of the MaxBackupIndex option.
95
-	 * @return integer 
95
+	 * @return string 
96 96
 	 */
97 97
 	private function getExpandedFileName() {
98 98
 		return $this->expandedFileName;
Please login to merge, or discard this patch.
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -48,183 +48,183 @@
 block discarded – undo
48 48
  */
49 49
 class LoggerAppenderRollingFile extends LoggerAppenderFile {
50 50
 
51
-	/**
52
-	 * Set the maximum size that the output file is allowed to reach
53
-	 * before being rolled over to backup files.
54
-	 *
55
-	 * <p>In configuration files, the <var>MaxFileSize</var> option takes a
56
-	 * long integer in the range 0 - 2^63. You can specify the value
57
-	 * with the suffixes "KB", "MB" or "GB" so that the integer is
58
-	 * interpreted being expressed respectively in kilobytes, megabytes
59
-	 * or gigabytes. For example, the value "10KB" will be interpreted
60
-	 * as 10240.</p>
61
-	 * <p>The default maximum file size is 10MB.</p>
62
-	 *
63
-	 * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
64
-	 *
65
-	 * @var integer
66
-	 */
67
-	private $maxFileSize = 10485760;
51
+    /**
52
+     * Set the maximum size that the output file is allowed to reach
53
+     * before being rolled over to backup files.
54
+     *
55
+     * <p>In configuration files, the <var>MaxFileSize</var> option takes a
56
+     * long integer in the range 0 - 2^63. You can specify the value
57
+     * with the suffixes "KB", "MB" or "GB" so that the integer is
58
+     * interpreted being expressed respectively in kilobytes, megabytes
59
+     * or gigabytes. For example, the value "10KB" will be interpreted
60
+     * as 10240.</p>
61
+     * <p>The default maximum file size is 10MB.</p>
62
+     *
63
+     * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
64
+     *
65
+     * @var integer
66
+     */
67
+    private $maxFileSize = 10485760;
68 68
 	
69
-	/**
70
-	 * Set the maximum number of backup files to keep around.
71
-	 * 
72
-	 * <p>The <var>MaxBackupIndex</var> option determines how many backup
73
-	 * files are kept before the oldest is erased. This option takes
74
-	 * a positive integer value. If set to zero, then there will be no
75
-	 * backup files and the log file will be truncated when it reaches
76
-	 * MaxFileSize.</p>
77
-	 * <p>There is one backup file by default.</p>
78
-	 *
79
-	 * @var integer 
80
-	 */
81
-	private $maxBackupIndex	 = 1;
69
+    /**
70
+     * Set the maximum number of backup files to keep around.
71
+     * 
72
+     * <p>The <var>MaxBackupIndex</var> option determines how many backup
73
+     * files are kept before the oldest is erased. This option takes
74
+     * a positive integer value. If set to zero, then there will be no
75
+     * backup files and the log file will be truncated when it reaches
76
+     * MaxFileSize.</p>
77
+     * <p>There is one backup file by default.</p>
78
+     *
79
+     * @var integer 
80
+     */
81
+    private $maxBackupIndex	 = 1;
82 82
 	
83
-	/**
84
-	 * @var string the filename expanded
85
-	 * @access private
86
-	 */
87
-	private $expandedFileName = null;
83
+    /**
84
+     * @var string the filename expanded
85
+     * @access private
86
+     */
87
+    private $expandedFileName = null;
88 88
 
89
-	public function __destruct() {
90
-       parent::__destruct();
91
-   	}
89
+    public function __destruct() {
90
+        parent::__destruct();
91
+        }
92 92
    	
93
-	/**
94
-	 * Returns the value of the MaxBackupIndex option.
95
-	 * @return integer 
96
-	 */
97
-	private function getExpandedFileName() {
98
-		return $this->expandedFileName;
99
-	}
93
+    /**
94
+     * Returns the value of the MaxBackupIndex option.
95
+     * @return integer 
96
+     */
97
+    private function getExpandedFileName() {
98
+        return $this->expandedFileName;
99
+    }
100 100
 
101
-	/**
102
-	 * Get the maximum size that the output file is allowed to reach
103
-	 * before being rolled over to backup files.
104
-	 * @return integer
105
-	 */
106
-	private function getMaximumFileSize() {
107
-		return $this->maxFileSize;
108
-	}
101
+    /**
102
+     * Get the maximum size that the output file is allowed to reach
103
+     * before being rolled over to backup files.
104
+     * @return integer
105
+     */
106
+    private function getMaximumFileSize() {
107
+        return $this->maxFileSize;
108
+    }
109 109
 
110
-	/**
111
-	 * Implements the usual roll over behaviour.
112
-	 *
113
-	 * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
114
-	 * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
115
-	 * 
116
-	 * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
117
-	 */
118
-	private function rollOver() {
119
-		// If maxBackups <= 0, then there is no file renaming to be done.
120
-		if($this->maxBackupIndex > 0) {
121
-			$fileName = $this->getExpandedFileName();
122
-			// Delete the oldest file, to keep Windows happy.
123
-			$file = $fileName . '.' . $this->maxBackupIndex;
124
-			if(is_writable($file))
125
-				unlink($file);
126
-			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
127
-			for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
128
-				$file = $fileName . "." . $i;
129
-				if(is_readable($file)) {
130
-					$target = $fileName . '.' . ($i + 1);
131
-					rename($file, $target);
132
-				}
133
-			}
110
+    /**
111
+     * Implements the usual roll over behaviour.
112
+     *
113
+     * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
114
+     * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
115
+     * 
116
+     * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
117
+     */
118
+    private function rollOver() {
119
+        // If maxBackups <= 0, then there is no file renaming to be done.
120
+        if($this->maxBackupIndex > 0) {
121
+            $fileName = $this->getExpandedFileName();
122
+            // Delete the oldest file, to keep Windows happy.
123
+            $file = $fileName . '.' . $this->maxBackupIndex;
124
+            if(is_writable($file))
125
+                unlink($file);
126
+            // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
127
+            for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
128
+                $file = $fileName . "." . $i;
129
+                if(is_readable($file)) {
130
+                    $target = $fileName . '.' . ($i + 1);
131
+                    rename($file, $target);
132
+                }
133
+            }
134 134
 	
135
-			$this->close();
135
+            $this->close();
136 136
 	
137
-			// Rename fileName to fileName.1
138
-			$target = $fileName . ".1";
139
-			$file = $fileName;
140
-			rename($file, $target);
141
-		}
137
+            // Rename fileName to fileName.1
138
+            $target = $fileName . ".1";
139
+            $file = $fileName;
140
+            rename($file, $target);
141
+        }
142 142
 		
143
-		//unset($this->fp);
144
-		$this->activateOptions();
145
-		$this->setFile($fileName, false);
146
-	}
143
+        //unset($this->fp);
144
+        $this->activateOptions();
145
+        $this->setFile($fileName, false);
146
+    }
147 147
 	
148
-	public function setFileName($fileName) {
149
-		$this->fileName = $fileName;
150
-		// As LoggerAppenderFile does not create the directory, it has to exist.
151
-		// realpath() fails if the argument does not exist so the filename is separated.
152
-		$this->expandedFileName = realpath(dirname($fileName));
153
-		if ($this->expandedFileName === false) throw new Exception("Directory of $fileName does not exist!");
154
-		$this->expandedFileName .= '/'.basename($fileName);
155
-	}
148
+    public function setFileName($fileName) {
149
+        $this->fileName = $fileName;
150
+        // As LoggerAppenderFile does not create the directory, it has to exist.
151
+        // realpath() fails if the argument does not exist so the filename is separated.
152
+        $this->expandedFileName = realpath(dirname($fileName));
153
+        if ($this->expandedFileName === false) throw new Exception("Directory of $fileName does not exist!");
154
+        $this->expandedFileName .= '/'.basename($fileName);
155
+    }
156 156
 
157 157
 
158
-	/**
159
-	 * Set the maximum number of backup files to keep around.
160
-	 * 
161
-	 * <p>The <b>MaxBackupIndex</b> option determines how many backup
162
-	 * files are kept before the oldest is erased. This option takes
163
-	 * a positive integer value. If set to zero, then there will be no
164
-	 * backup files and the log file will be truncated when it reaches
165
-	 * MaxFileSize.
166
-	 *
167
-	 * @param mixed $maxBackups
168
-	 */
169
-	public function setMaxBackupIndex($maxBackups) {
170
-		if(is_numeric($maxBackups)) {
171
-			$this->maxBackupIndex = abs((int)$maxBackups);
172
-		}
173
-	}
158
+    /**
159
+     * Set the maximum number of backup files to keep around.
160
+     * 
161
+     * <p>The <b>MaxBackupIndex</b> option determines how many backup
162
+     * files are kept before the oldest is erased. This option takes
163
+     * a positive integer value. If set to zero, then there will be no
164
+     * backup files and the log file will be truncated when it reaches
165
+     * MaxFileSize.
166
+     *
167
+     * @param mixed $maxBackups
168
+     */
169
+    public function setMaxBackupIndex($maxBackups) {
170
+        if(is_numeric($maxBackups)) {
171
+            $this->maxBackupIndex = abs((int)$maxBackups);
172
+        }
173
+    }
174 174
 
175
-	/**
176
-	 * Set the maximum size that the output file is allowed to reach
177
-	 * before being rolled over to backup files.
178
-	 *
179
-	 * @param mixed $maxFileSize
180
-	 * @see setMaxFileSize()
181
-	 * @deprecated
182
-	 */
183
-	public function setMaximumFileSize($maxFileSize) {
184
-		return $this->setMaxFileSize($maxFileSize);
185
-	}
175
+    /**
176
+     * Set the maximum size that the output file is allowed to reach
177
+     * before being rolled over to backup files.
178
+     *
179
+     * @param mixed $maxFileSize
180
+     * @see setMaxFileSize()
181
+     * @deprecated
182
+     */
183
+    public function setMaximumFileSize($maxFileSize) {
184
+        return $this->setMaxFileSize($maxFileSize);
185
+    }
186 186
 
187
-	/**
188
-	 * Set the maximum size that the output file is allowed to reach
189
-	 * before being rolled over to backup files.
190
-	 * <p>In configuration files, the <b>MaxFileSize</b> option takes an
191
-	 * long integer in the range 0 - 2^63. You can specify the value
192
-	 * with the suffixes "KB", "MB" or "GB" so that the integer is
193
-	 * interpreted being expressed respectively in kilobytes, megabytes
194
-	 * or gigabytes. For example, the value "10KB" will be interpreted
195
-	 * as 10240.
196
-	 *
197
-	 * @param mixed $value
198
-	 * @return the actual file size set
199
-	 */
200
-	public function setMaxFileSize($value) {
201
-		$maxFileSize = null;
202
-		$numpart = substr($value,0, strlen($value) -2);
203
-		$suffix = strtoupper(substr($value, -2));
187
+    /**
188
+     * Set the maximum size that the output file is allowed to reach
189
+     * before being rolled over to backup files.
190
+     * <p>In configuration files, the <b>MaxFileSize</b> option takes an
191
+     * long integer in the range 0 - 2^63. You can specify the value
192
+     * with the suffixes "KB", "MB" or "GB" so that the integer is
193
+     * interpreted being expressed respectively in kilobytes, megabytes
194
+     * or gigabytes. For example, the value "10KB" will be interpreted
195
+     * as 10240.
196
+     *
197
+     * @param mixed $value
198
+     * @return the actual file size set
199
+     */
200
+    public function setMaxFileSize($value) {
201
+        $maxFileSize = null;
202
+        $numpart = substr($value,0, strlen($value) -2);
203
+        $suffix = strtoupper(substr($value, -2));
204 204
 
205
-		switch($suffix) {
206
-			case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
207
-			case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
208
-			case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
209
-			default:
210
-				if(is_numeric($value)) {
211
-					$maxFileSize = (int)$value;
212
-				}
213
-		}
205
+        switch($suffix) {
206
+            case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
207
+            case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
208
+            case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
209
+            default:
210
+                if(is_numeric($value)) {
211
+                    $maxFileSize = (int)$value;
212
+                }
213
+        }
214 214
 		
215
-		if($maxFileSize !== null) {
216
-			$this->maxFileSize = abs($maxFileSize);
217
-		}
218
-		return $this->maxFileSize;
219
-	}
215
+        if($maxFileSize !== null) {
216
+            $this->maxFileSize = abs($maxFileSize);
217
+        }
218
+        return $this->maxFileSize;
219
+    }
220 220
 
221
-	/**
222
-	 * @param LoggerLoggingEvent $event
223
-	 */
224
-	public function append(LoggerLoggingEvent $event) {
225
-		parent::append($event);
226
-		if(ftell($this->fp) > $this->getMaximumFileSize()) {
227
-			$this->rollOver();
228
-		}
229
-	}
221
+    /**
222
+     * @param LoggerLoggingEvent $event
223
+     */
224
+    public function append(LoggerLoggingEvent $event) {
225
+        parent::append($event);
226
+        if(ftell($this->fp) > $this->getMaximumFileSize()) {
227
+            $this->rollOver();
228
+        }
229
+    }
230 230
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @var integer 
80 80
 	 */
81
-	private $maxBackupIndex	 = 1;
81
+	private $maxBackupIndex = 1;
82 82
 	
83 83
 	/**
84 84
 	 * @var string the filename expanded
@@ -117,17 +117,17 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	private function rollOver() {
119 119
 		// If maxBackups <= 0, then there is no file renaming to be done.
120
-		if($this->maxBackupIndex > 0) {
120
+		if ($this->maxBackupIndex > 0) {
121 121
 			$fileName = $this->getExpandedFileName();
122 122
 			// Delete the oldest file, to keep Windows happy.
123
-			$file = $fileName . '.' . $this->maxBackupIndex;
124
-			if(is_writable($file))
123
+			$file = $fileName.'.'.$this->maxBackupIndex;
124
+			if (is_writable($file))
125 125
 				unlink($file);
126 126
 			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
127
-			for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
128
-				$file = $fileName . "." . $i;
129
-				if(is_readable($file)) {
130
-					$target = $fileName . '.' . ($i + 1);
127
+			for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
128
+				$file = $fileName.".".$i;
129
+				if (is_readable($file)) {
130
+					$target = $fileName.'.'.($i + 1);
131 131
 					rename($file, $target);
132 132
 				}
133 133
 			}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			$this->close();
136 136
 	
137 137
 			// Rename fileName to fileName.1
138
-			$target = $fileName . ".1";
138
+			$target = $fileName.".1";
139 139
 			$file = $fileName;
140 140
 			rename($file, $target);
141 141
 		}
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param mixed $maxBackups
168 168
 	 */
169 169
 	public function setMaxBackupIndex($maxBackups) {
170
-		if(is_numeric($maxBackups)) {
171
-			$this->maxBackupIndex = abs((int)$maxBackups);
170
+		if (is_numeric($maxBackups)) {
171
+			$this->maxBackupIndex = abs((int) $maxBackups);
172 172
 		}
173 173
 	}
174 174
 
@@ -199,20 +199,20 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function setMaxFileSize($value) {
201 201
 		$maxFileSize = null;
202
-		$numpart = substr($value,0, strlen($value) -2);
202
+		$numpart = substr($value, 0, strlen($value) - 2);
203 203
 		$suffix = strtoupper(substr($value, -2));
204 204
 
205
-		switch($suffix) {
206
-			case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
207
-			case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
208
-			case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
205
+		switch ($suffix) {
206
+			case 'KB': $maxFileSize = (int) ((int) $numpart * 1024); break;
207
+			case 'MB': $maxFileSize = (int) ((int) $numpart * 1024 * 1024); break;
208
+			case 'GB': $maxFileSize = (int) ((int) $numpart * 1024 * 1024 * 1024); break;
209 209
 			default:
210
-				if(is_numeric($value)) {
211
-					$maxFileSize = (int)$value;
210
+				if (is_numeric($value)) {
211
+					$maxFileSize = (int) $value;
212 212
 				}
213 213
 		}
214 214
 		
215
-		if($maxFileSize !== null) {
215
+		if ($maxFileSize !== null) {
216 216
 			$this->maxFileSize = abs($maxFileSize);
217 217
 		}
218 218
 		return $this->maxFileSize;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function append(LoggerLoggingEvent $event) {
225 225
 		parent::append($event);
226
-		if(ftell($this->fp) > $this->getMaximumFileSize()) {
226
+		if (ftell($this->fp) > $this->getMaximumFileSize()) {
227 227
 			$this->rollOver();
228 228
 		}
229 229
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@  discard block
 block discarded – undo
121 121
 			$fileName = $this->getExpandedFileName();
122 122
 			// Delete the oldest file, to keep Windows happy.
123 123
 			$file = $fileName . '.' . $this->maxBackupIndex;
124
-			if(is_writable($file))
125
-				unlink($file);
124
+			if(is_writable($file)) {
125
+							unlink($file);
126
+			}
126 127
 			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
127 128
 			for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
128 129
 				$file = $fileName . "." . $i;
@@ -150,7 +151,9 @@  discard block
 block discarded – undo
150 151
 		// As LoggerAppenderFile does not create the directory, it has to exist.
151 152
 		// realpath() fails if the argument does not exist so the filename is separated.
152 153
 		$this->expandedFileName = realpath(dirname($fileName));
153
-		if ($this->expandedFileName === false) throw new Exception("Directory of $fileName does not exist!");
154
+		if ($this->expandedFileName === false) {
155
+		    throw new Exception("Directory of $fileName does not exist!");
156
+		}
154 157
 		$this->expandedFileName .= '/'.basename($fileName);
155 158
 	}
156 159
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/appenders/LoggerAppenderSocket.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -225,6 +225,7 @@
 block discarded – undo
225 225
 	
226 226
 	/**
227 227
 	 * @param mixed
228
+	 * @param boolean $flag
228 229
 	 */
229 230
 	public function setUseXml($flag) {
230 231
 		$this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
Please login to merge, or discard this patch.
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -46,215 +46,215 @@
 block discarded – undo
46 46
  */ 
47 47
 class LoggerAppenderSocket extends LoggerAppender {
48 48
 
49
-	/**
50
-	 * @var mixed socket connection resource
51
-	 * @access private
52
-	 */
53
-	private $sp = false;
49
+    /**
50
+     * @var mixed socket connection resource
51
+     * @access private
52
+     */
53
+    private $sp = false;
54 54
 	
55
-	/**
56
-	 * Target host. On how to define remote hostaname see 
57
-	 * {@link PHP_MANUAL#fsockopen}
58
-	 * @var string 
59
-	 */
60
-	private $remoteHost = '';
55
+    /**
56
+     * Target host. On how to define remote hostaname see 
57
+     * {@link PHP_MANUAL#fsockopen}
58
+     * @var string 
59
+     */
60
+    private $remoteHost = '';
61 61
 	
62
-	/**
63
-	 * @var integer the network port.
64
-	 */
65
-	private $port = 4446;
62
+    /**
63
+     * @var integer the network port.
64
+     */
65
+    private $port = 4446;
66 66
 	
67
-	/**
68
-	 * @var boolean get event's location info.
69
-	 */
70
-	private $locationInfo = false;
67
+    /**
68
+     * @var boolean get event's location info.
69
+     */
70
+    private $locationInfo = false;
71 71
 	
72
-	/**
73
-	 * @var integer connection timeout
74
-	 */
75
-	private $timeout = 30;
72
+    /**
73
+     * @var integer connection timeout
74
+     */
75
+    private $timeout = 30;
76 76
 	
77
-	/**
78
-	 * @var boolean output events via {@link LoggerXmlLayout}
79
-	 */
80
-	private $useXml = false;
77
+    /**
78
+     * @var boolean output events via {@link LoggerXmlLayout}
79
+     */
80
+    private $useXml = false;
81 81
 	
82
-	/**
83
-	 * @var boolean forward this option to {@link LoggerXmlLayout}. 
84
-	 *				Ignored if {@link $useXml} is <i>false</i>.
85
-	 */
86
-	private $log4jNamespace = false;
82
+    /**
83
+     * @var boolean forward this option to {@link LoggerXmlLayout}. 
84
+     *				Ignored if {@link $useXml} is <i>false</i>.
85
+     */
86
+    private $log4jNamespace = false;
87 87
 
88
-	/**
89
-	 * @var LoggerXmlLayout
90
-	 * @access private
91
-	 */
92
-	private $xmlLayout = null;
88
+    /**
89
+     * @var LoggerXmlLayout
90
+     * @access private
91
+     */
92
+    private $xmlLayout = null;
93 93
 	
94
-	/** @var indiciates if this appender should run in dry mode */
95
-	private $dry = false;
94
+    /** @var indiciates if this appender should run in dry mode */
95
+    private $dry = false;
96 96
 	
97
-	public function __destruct() {
98
-       $this->close();
99
-   	}
97
+    public function __destruct() {
98
+        $this->close();
99
+        }
100 100
    	
101
-	/**
102
-	 * Create a socket connection using defined parameters
103
-	 */
104
-	public function activateOptions() {
105
-		if(!$this->dry) {
106
-			$this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
107
-			if ($this->sp === false) {
108
-			    throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)");
109
-			}
110
-		}
111
-		if($this->getUseXml()) {
112
-			$this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml');
113
-			if($this->xmlLayout === null) {
114
-				$this->setUseXml(false);
115
-			} else {
116
-				$this->xmlLayout->setLocationInfo($this->getLocationInfo());
117
-				$this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
118
-				$this->xmlLayout->activateOptions();
119
-			}			 
120
-		}
101
+    /**
102
+     * Create a socket connection using defined parameters
103
+     */
104
+    public function activateOptions() {
105
+        if(!$this->dry) {
106
+            $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
107
+            if ($this->sp === false) {
108
+                throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)");
109
+            }
110
+        }
111
+        if($this->getUseXml()) {
112
+            $this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml');
113
+            if($this->xmlLayout === null) {
114
+                $this->setUseXml(false);
115
+            } else {
116
+                $this->xmlLayout->setLocationInfo($this->getLocationInfo());
117
+                $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
118
+                $this->xmlLayout->activateOptions();
119
+            }			 
120
+        }
121 121
         $this->closed = false;
122
-	}
122
+    }
123 123
 	
124
-	public function close() {
125
-		if($this->closed != true) {
126
-			if(!$this->dry and $this->sp !== false) {
127
-				fclose($this->sp);
128
-			}
129
-			$this->closed = true;
130
-		}
131
-	}
124
+    public function close() {
125
+        if($this->closed != true) {
126
+            if(!$this->dry and $this->sp !== false) {
127
+                fclose($this->sp);
128
+            }
129
+            $this->closed = true;
130
+        }
131
+    }
132 132
 
133
-	public function setDry($dry) {
134
-		$this->dry = $dry;
135
-	}
133
+    public function setDry($dry) {
134
+        $this->dry = $dry;
135
+    }
136 136
 	
137
-	/**
138
-	 * @return string
139
-	 */
140
-	public function getHostname() {
141
-		return $this->getRemoteHost();
142
-	}
137
+    /**
138
+     * @return string
139
+     */
140
+    public function getHostname() {
141
+        return $this->getRemoteHost();
142
+    }
143 143
 	
144
-	/**
145
-	 * @return boolean
146
-	 */
147
-	public function getLocationInfo() {
148
-		return $this->locationInfo;
149
-	} 
144
+    /**
145
+     * @return boolean
146
+     */
147
+    public function getLocationInfo() {
148
+        return $this->locationInfo;
149
+    } 
150 150
 	 
151
-	/**
152
-	 * @return boolean
153
-	 */
154
-	public function getLog4jNamespace() {
155
-		return $this->log4jNamespace;
156
-	}
151
+    /**
152
+     * @return boolean
153
+     */
154
+    public function getLog4jNamespace() {
155
+        return $this->log4jNamespace;
156
+    }
157 157
 
158
-	/**
159
-	 * @return integer
160
-	 */
161
-	public function getPort() {
162
-		return $this->port;
163
-	}
158
+    /**
159
+     * @return integer
160
+     */
161
+    public function getPort() {
162
+        return $this->port;
163
+    }
164 164
 	
165
-	public function getRemoteHost() {
166
-		return $this->remoteHost;
167
-	}
165
+    public function getRemoteHost() {
166
+        return $this->remoteHost;
167
+    }
168 168
 	
169
-	/**
170
-	 * @return integer
171
-	 */
172
-	public function getTimeout() {
173
-		return $this->timeout;
174
-	}
169
+    /**
170
+     * @return integer
171
+     */
172
+    public function getTimeout() {
173
+        return $this->timeout;
174
+    }
175 175
 	
176
-	/**
177
-	 * @var boolean
178
-	 */
179
-	public function getUseXml() {
180
-		return $this->useXml;
181
-	} 
176
+    /**
177
+     * @var boolean
178
+     */
179
+    public function getUseXml() {
180
+        return $this->useXml;
181
+    } 
182 182
 	 
183
-	public function reset() {
184
-		$this->close();
185
-		parent::reset();
186
-	}
183
+    public function reset() {
184
+        $this->close();
185
+        parent::reset();
186
+    }
187 187
 
188
-	/**
189
-	 * @param mixed
190
-	 */
191
-	public function setLocationInfo($flag) {
192
-		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
193
-	} 
188
+    /**
189
+     * @param mixed
190
+     */
191
+    public function setLocationInfo($flag) {
192
+        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
193
+    } 
194 194
 
195
-	/**
196
-	 * @param mixed
197
-	 */
198
-	public function setLog4jNamespace($flag) {
199
-		$this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
200
-	} 
195
+    /**
196
+     * @param mixed
197
+     */
198
+    public function setLog4jNamespace($flag) {
199
+        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
200
+    } 
201 201
 			
202
-	/**
203
-	 * @param integer
204
-	 */
205
-	public function setPort($port) {
206
-		$port = LoggerOptionConverter::toInt($port, 0);
207
-		if($port > 0 and $port < 65535) {
208
-			$this->port = $port;	
209
-		}
210
-	}
202
+    /**
203
+     * @param integer
204
+     */
205
+    public function setPort($port) {
206
+        $port = LoggerOptionConverter::toInt($port, 0);
207
+        if($port > 0 and $port < 65535) {
208
+            $this->port = $port;	
209
+        }
210
+    }
211 211
 	
212
-	/**
213
-	 * @param string
214
-	 */
215
-	public function setRemoteHost($hostname) {
216
-		$this->remoteHost = $hostname;
217
-	}
212
+    /**
213
+     * @param string
214
+     */
215
+    public function setRemoteHost($hostname) {
216
+        $this->remoteHost = $hostname;
217
+    }
218 218
 	
219
-	/**
220
-	 * @param integer
221
-	 */
222
-	public function setTimeout($timeout) {
223
-		$this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
224
-	}
219
+    /**
220
+     * @param integer
221
+     */
222
+    public function setTimeout($timeout) {
223
+        $this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
224
+    }
225 225
 	
226
-	/**
227
-	 * @param mixed
228
-	 */
229
-	public function setUseXml($flag) {
230
-		$this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
231
-	} 
226
+    /**
227
+     * @param mixed
228
+     */
229
+    public function setUseXml($flag) {
230
+        $this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
231
+    } 
232 232
  
233
-	public function append(LoggerLoggingEvent $event) {
234
-		if($this->sp || $this->dry) {
235
-			if($this->getLocationInfo()) {
236
-				$event->getLocationInformation();
237
-			}
233
+    public function append(LoggerLoggingEvent $event) {
234
+        if($this->sp || $this->dry) {
235
+            if($this->getLocationInfo()) {
236
+                $event->getLocationInformation();
237
+            }
238 238
 		
239
-			if(!$this->getUseXml()) {
240
-				$sEvent = serialize($event);
241
-				if(!$this->dry) {
242
-					fwrite($this->sp, $sEvent, strlen($sEvent));
243
-				} else {
244
-				    echo "DRY MODE OF SOCKET APPENDER: ".$sEvent;
245
-				}
246
-			} else {
247
-				if(!$this->dry) {
248
-					fwrite($this->sp, $this->xmlLayout->format($event));
249
-				} else {
250
-				    echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event);
251
-				}
252
-			}			 
239
+            if(!$this->getUseXml()) {
240
+                $sEvent = serialize($event);
241
+                if(!$this->dry) {
242
+                    fwrite($this->sp, $sEvent, strlen($sEvent));
243
+                } else {
244
+                    echo "DRY MODE OF SOCKET APPENDER: ".$sEvent;
245
+                }
246
+            } else {
247
+                if(!$this->dry) {
248
+                    fwrite($this->sp, $this->xmlLayout->format($event));
249
+                } else {
250
+                    echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event);
251
+                }
252
+            }			 
253 253
 
254
-			// not sure about it...
255
-			if(!$this->dry) {
256
-				fflush($this->sp);
257
-			}
258
-		} 
259
-	}
254
+            // not sure about it...
255
+            if(!$this->dry) {
256
+                fflush($this->sp);
257
+            }
258
+        } 
259
+    }
260 260
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 	 * Create a socket connection using defined parameters
103 103
 	 */
104 104
 	public function activateOptions() {
105
-		if(!$this->dry) {
105
+		if (!$this->dry) {
106 106
 			$this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
107 107
 			if ($this->sp === false) {
108 108
 			    throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)");
109 109
 			}
110 110
 		}
111
-		if($this->getUseXml()) {
111
+		if ($this->getUseXml()) {
112 112
 			$this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml');
113
-			if($this->xmlLayout === null) {
113
+			if ($this->xmlLayout === null) {
114 114
 				$this->setUseXml(false);
115 115
 			} else {
116 116
 				$this->xmlLayout->setLocationInfo($this->getLocationInfo());
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 	
124 124
 	public function close() {
125
-		if($this->closed != true) {
126
-			if(!$this->dry and $this->sp !== false) {
125
+		if ($this->closed != true) {
126
+			if (!$this->dry and $this->sp !== false) {
127 127
 				fclose($this->sp);
128 128
 			}
129 129
 			$this->closed = true;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function setPort($port) {
206 206
 		$port = LoggerOptionConverter::toInt($port, 0);
207
-		if($port > 0 and $port < 65535) {
207
+		if ($port > 0 and $port < 65535) {
208 208
 			$this->port = $port;	
209 209
 		}
210 210
 	}
@@ -231,20 +231,20 @@  discard block
 block discarded – undo
231 231
 	} 
232 232
  
233 233
 	public function append(LoggerLoggingEvent $event) {
234
-		if($this->sp || $this->dry) {
235
-			if($this->getLocationInfo()) {
234
+		if ($this->sp || $this->dry) {
235
+			if ($this->getLocationInfo()) {
236 236
 				$event->getLocationInformation();
237 237
 			}
238 238
 		
239
-			if(!$this->getUseXml()) {
239
+			if (!$this->getUseXml()) {
240 240
 				$sEvent = serialize($event);
241
-				if(!$this->dry) {
241
+				if (!$this->dry) {
242 242
 					fwrite($this->sp, $sEvent, strlen($sEvent));
243 243
 				} else {
244 244
 				    echo "DRY MODE OF SOCKET APPENDER: ".$sEvent;
245 245
 				}
246 246
 			} else {
247
-				if(!$this->dry) {
247
+				if (!$this->dry) {
248 248
 					fwrite($this->sp, $this->xmlLayout->format($event));
249 249
 				} else {
250 250
 				    echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			}			 
253 253
 
254 254
 			// not sure about it...
255
-			if(!$this->dry) {
255
+			if (!$this->dry) {
256 256
 				fflush($this->sp);
257 257
 			}
258 258
 		} 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/configurators/LoggerConfiguratorIni.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -279,7 +279,6 @@
 block discarded – undo
279 279
 	 * 
280 280
 	 * @param string $url The name of the configuration file where the
281 281
 	 *					  configuration information is stored.
282
-	 * @param LoggerHierarchy $repository the repository to apply the configuration
283 282
 	 */
284 283
 	public function configure(LoggerHierarchy $hierarchy, $url = '') {
285 284
 		$properties = @parse_ini_file($url);
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 		$effectivePrefix = self::ROOT_LOGGER_PREFIX;
314 314
 		$value = @$props[self::ROOT_LOGGER_PREFIX];
315 315
 
316
-		if(empty($value)) {
316
+		if (empty($value)) {
317 317
 			$value = @$props[self::ROOT_CATEGORY_PREFIX];
318 318
 			$effectivePrefix = self::ROOT_CATEGORY_PREFIX;
319 319
 		}
320 320
 
321
-		if(empty($value)) {
321
+		if (empty($value)) {
322 322
 			// TODO "Could not find root logger information. Is this OK?"
323 323
 		} else {
324 324
 			$root = $hierarchy->getRootLogger();
325
-			$this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
325
+			$this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME, $value);
326 326
 		}
327 327
 	}
328 328
 
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
 	 * @param LoggerHierarchy $hierarchy
334 334
 	 */
335 335
 	private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
336
-		while(list($key,$value) = each($props)) {
337
-			if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
336
+		while (list($key, $value) = each($props)) {
337
+			if (strpos($key, self::CATEGORY_PREFIX) === 0 or 
338 338
 				strpos($key, self::LOGGER_PREFIX) === 0) {
339
-				if(strpos($key, self::CATEGORY_PREFIX) === 0) {
339
+				if (strpos($key, self::CATEGORY_PREFIX) === 0) {
340 340
 					$loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
341
-				} else if(strpos($key, self::LOGGER_PREFIX) === 0) {
341
+				} else if (strpos($key, self::LOGGER_PREFIX) === 0) {
342 342
 					$loggerName = substr($key, strlen(self::LOGGER_PREFIX));
343 343
 				}
344 344
 				
345 345
 				$logger = $hierarchy->getLogger($loggerName);
346 346
 				$this->parseCategory($props, $logger, $key, $loggerName, $value);
347 347
 				$this->parseAdditivityForLogger($props, $logger, $loggerName);
348
-			} else if(strpos($key, self::RENDERER_PREFIX) === 0) {
348
+			} else if (strpos($key, self::RENDERER_PREFIX) === 0) {
349 349
 				$renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
350 350
 				$renderingClass = $value;
351 351
 				$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 	 * @param string $loggerName
362 362
 	 */
363 363
 	private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
364
-		$value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
364
+		$value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX.$loggerName, $props);
365 365
 		
366 366
 		// touch additivity only if necessary
367
-		if(!empty($value)) {
367
+		if (!empty($value)) {
368 368
 			$additivity = LoggerOptionConverter::toBoolean($value, true);
369 369
 			$cat->setAdditivity($additivity);
370 370
 		}
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 		// If value is not in the form ", appender.." or "", then we should set
388 388
 		// the level of the loggeregory.
389 389
 
390
-		if(!(empty($value) || @$value[0] == ',')) {
390
+		if (!(empty($value) || @$value[0] == ',')) {
391 391
 			// just to be on the safe side...
392
-			if(count($st) == 0) {
392
+			if (count($st) == 0) {
393 393
 				return;
394 394
 			}
395 395
 			$levelStr = current($st);
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 			// If the level value is inherited, set category level value to
398 398
 			// null. We also check that the user has not specified inherited for the
399 399
 			// root category.
400
-			if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
-				if($loggerName == self::INTERNAL_ROOT_NAME) {
400
+			if ('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
+				if ($loggerName == self::INTERNAL_ROOT_NAME) {
402 402
 					// TODO: throw exception?	"The root logger cannot be set to null."
403 403
 				} else {
404 404
 					$logger->setLevel(null);
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
 
411 411
 		// TODO: removing should be done by the logger, if necessary and wanted 
412 412
 		// $logger->removeAllAppenders();
413
-		while($appenderName = next($st)) {
413
+		while ($appenderName = next($st)) {
414 414
 			$appenderName = trim($appenderName);
415
-			if(empty($appenderName)) {
415
+			if (empty($appenderName)) {
416 416
 				continue;
417 417
 			}
418 418
 			
419 419
 			$appender = $this->parseAppender($props, $appenderName);
420
-			if($appender !== null) {
420
+			if ($appender !== null) {
421 421
 					$logger->addAppender($appender);
422 422
 			}
423 423
 		}
@@ -430,34 +430,34 @@  discard block
 block discarded – undo
430 430
 	 */
431 431
 	private function parseAppender($props, $appenderName) {
432 432
 		$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
433
-		$prefix = self::APPENDER_PREFIX . $appenderName;
434
-		if($appender === null) {
433
+		$prefix = self::APPENDER_PREFIX.$appenderName;
434
+		if ($appender === null) {
435 435
 			// Appender was not previously initialized.
436 436
 			$appenderClass = @$props[$prefix];
437 437
 			$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
438
-			if($appender === null) {
438
+			if ($appender === null) {
439 439
 				return null;
440 440
 			}
441 441
 		}
442 442
 		
443
-		if($appender->requiresLayout() ) {
444
-			$layoutPrefix = $prefix . ".layout";
443
+		if ($appender->requiresLayout()) {
444
+			$layoutPrefix = $prefix.".layout";
445 445
 			$layoutClass = @$props[$layoutPrefix];
446 446
 			$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
447
-			if(empty($layoutClass)) {
447
+			if (empty($layoutClass)) {
448 448
 				$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
449 449
 			} else {
450 450
 				$layout = LoggerReflectionUtils::createObject($layoutClass);
451
-				if($layout === null) {
451
+				if ($layout === null) {
452 452
 					$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
453 453
 				}
454 454
 			}
455 455
 			
456
-			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
456
+			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix.".");				  
457 457
 			$appender->setLayout($layout);
458 458
 			
459 459
 		}
460
-		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
460
+		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix.".");
461 461
 		return $appender;		 
462 462
 	}
463 463
 }
Please login to merge, or discard this patch.
Indentation   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -63,401 +63,401 @@
 block discarded – undo
63 63
  * @since 0.5
64 64
  */
65 65
 class LoggerConfiguratorIni implements LoggerConfigurator {
66
- 	const CATEGORY_PREFIX = "log4php.category.";
67
- 	const LOGGER_PREFIX = "log4php.logger.";
68
-	const FACTORY_PREFIX = "log4php.factory";
69
-	const ADDITIVITY_PREFIX = "log4php.additivity.";
70
-	const ROOT_CATEGORY_PREFIX = "log4php.rootCategory";
71
-	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
72
-	const APPENDER_PREFIX = "log4php.appender.";
73
-	const RENDERER_PREFIX = "log4php.renderer.";
74
-	const THRESHOLD_PREFIX = "log4php.threshold";
66
+        const CATEGORY_PREFIX = "log4php.category.";
67
+        const LOGGER_PREFIX = "log4php.logger.";
68
+    const FACTORY_PREFIX = "log4php.factory";
69
+    const ADDITIVITY_PREFIX = "log4php.additivity.";
70
+    const ROOT_CATEGORY_PREFIX = "log4php.rootCategory";
71
+    const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
72
+    const APPENDER_PREFIX = "log4php.appender.";
73
+    const RENDERER_PREFIX = "log4php.renderer.";
74
+    const THRESHOLD_PREFIX = "log4php.threshold";
75 75
 	
76
-	/** 
77
-	 * Key for specifying the {@link LoggerFactory}.  
78
-	 */
79
-	const LOGGER_FACTORY_KEY = "log4php.loggerFactory";
80
-	const LOGGER_DEBUG_KEY = "log4php.debug";
81
-	const INTERNAL_ROOT_NAME = "root";
76
+    /** 
77
+     * Key for specifying the {@link LoggerFactory}.  
78
+     */
79
+    const LOGGER_FACTORY_KEY = "log4php.loggerFactory";
80
+    const LOGGER_DEBUG_KEY = "log4php.debug";
81
+    const INTERNAL_ROOT_NAME = "root";
82 82
 	
83
-	/**
84
-	 * Constructor
85
-	 */
86
-	public function __construct() {
87
-	}
83
+    /**
84
+     * Constructor
85
+     */
86
+    public function __construct() {
87
+    }
88 88
 
89
-	/**
90
-	 * Read configuration from a file.
91
-	 *
92
-	 * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
93
-	 * file.</p>
94
-	 *
95
-	 * <b>The existing configuration is not cleared nor reset.</b> 
96
-	 * If you require a different behavior, then call 
97
-	 * {@link  Logger::resetConfiguration()} 
98
-	 * method before calling {@link doConfigure()}.
99
-	 * 
100
-	 * <p>The configuration file consists of statements in the format
101
-	 * <b>key=value</b>. The syntax of different configuration
102
-	 * elements are discussed below.
103
-	 * 
104
-	 * <p><b>Repository-wide threshold</b></p>
105
-	 * 
106
-	 * <p>The repository-wide threshold filters logging requests by level
107
-	 * regardless of logger. The syntax is:
108
-	 * 
109
-	 * <pre>
110
-	 * log4php.threshold=[level]
111
-	 * </pre>
112
-	 * 
113
-	 * <p>The level value can consist of the string values OFF, FATAL,
114
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
115
-	 * custom level value can be specified in the form
116
-	 * <samp>level#classname</samp>. By default the repository-wide threshold is set
117
-	 * to the lowest possible value, namely the level <b>ALL</b>.
118
-	 * </p>
119
-	 * 
120
-	 * 
121
-	 * <p><b>Appender configuration</b></p>
122
-	 * 
123
-	 * <p>Appender configuration syntax is:</p>
124
-	 * <pre>
125
-	 * ; For appender named <i>appenderName</i>, set its class.
126
-	 * ; Note: The appender name can contain dots.
127
-	 * log4php.appender.appenderName=name_of_appender_class
128
-	 * 
129
-	 * ; Set appender specific options.
130
-	 * 
131
-	 * log4php.appender.appenderName.option1=value1
132
-	 * log4php.appender.appenderName.optionN=valueN
133
-	 * </pre>
134
-	 * 
135
-	 * For each named appender you can configure its {@link LoggerLayout}. The
136
-	 * syntax for configuring an appender's layout is:
137
-	 * <pre>
138
-	 * log4php.appender.appenderName.layout=name_of_layout_class
139
-	 * log4php.appender.appenderName.layout.option1=value1
140
-	 *	....
141
-	 * log4php.appender.appenderName.layout.optionN=valueN
142
-	 * </pre>
143
-	 * 
144
-	 * <p><b>Configuring loggers</b></p>
145
-	 * 
146
-	 * <p>The syntax for configuring the root logger is:
147
-	 * <pre>
148
-	 * log4php.rootLogger=[level], appenderName, appenderName, ...
149
-	 * </pre>
150
-	 * 
151
-	 * <p>This syntax means that an optional <i>level</i> can be
152
-	 * supplied followed by appender names separated by commas.
153
-	 * 
154
-	 * <p>The level value can consist of the string values OFF, FATAL,
155
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
156
-	 * custom level value can be specified in the form</p>
157
-	 *
158
-	 * <pre>level#classname</pre>
159
-	 * 
160
-	 * <p>If a level value is specified, then the root level is set
161
-	 * to the corresponding level.	If no level value is specified,
162
-	 * then the root level remains untouched.
163
-	 * 
164
-	 * <p>The root logger can be assigned multiple appenders.
165
-	 * 
166
-	 * <p>Each <i>appenderName</i> (separated by commas) will be added to
167
-	 * the root logger. The named appender is defined using the
168
-	 * appender syntax defined above.
169
-	 * 
170
-	 * <p>For non-root categories the syntax is almost the same:
171
-	 * <pre>
172
-	 * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
173
-	 * </pre>
174
-	 * 
175
-	 * <p>The meaning of the optional level value is discussed above
176
-	 * in relation to the root logger. In addition however, the value
177
-	 * INHERITED can be specified meaning that the named logger should
178
-	 * inherit its level from the logger hierarchy.</p>
179
-	 * 
180
-	 * <p>If no level value is supplied, then the level of the
181
-	 * named logger remains untouched.</p>
182
-	 * 
183
-	 * <p>By default categories inherit their level from the
184
-	 * hierarchy. However, if you set the level of a logger and later
185
-	 * decide that that logger should inherit its level, then you should
186
-	 * specify INHERITED as the value for the level value. NULL is a
187
-	 * synonym for INHERITED.</p>
188
-	 * 
189
-	 * <p>Similar to the root logger syntax, each <i>appenderName</i>
190
-	 * (separated by commas) will be attached to the named logger.</p>
191
-	 * 
192
-	 * <p>See the <i>appender additivity rule</i> in the user manual for 
193
-	 * the meaning of the <b>additivity</b> flag.
194
-	 * 
195
-	 * <p><b>ObjectRenderers</b></p>
196
-	 * 
197
-	 * <p>You can customize the way message objects of a given type are
198
-	 * converted to String before being logged. This is done by
199
-	 * specifying a {@link LoggerRendererObject}
200
-	 * for the object type would like to customize.</p>
201
-	 * 
202
-	 * <p>The syntax is:
203
-	 * 
204
-	 * <pre>
205
-	 * log4php.renderer.name_of_rendered_class=name_of_rendering.class
206
-	 * </pre>
207
-	 * 
208
-	 * As in,
209
-	 * <pre>
210
-	 * log4php.renderer.myFruit=myFruitRenderer
211
-	 * </pre>
212
-	 * 
213
-	 * <p><b>Logger Factories</b></p>
214
-	 * 
215
-	 * The usage of custom logger factories is discouraged and no longer
216
-	 * documented.
217
-	 * 
218
-	 * <p><b>Example</b></p>
219
-	 * 
220
-	 * <p>An example configuration is given below. Other configuration
221
-	 * file examples are given in the <b>tests</b> folder.
222
-	 * 
223
-	 * <pre>
224
-	 * ; Set options for appender named "A1".
225
-	 * ; Appender "A1" will be a LoggerAppenderSyslog
226
-	 * log4php.appender.A1=LoggerAppenderSyslog
227
-	 * 
228
-	 * ; The syslog daemon resides on www.abc.net
229
-	 * log4php.appender.A1.ident=log4php-test
230
-	 * 
231
-	 * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
232
-	 * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
233
-	 * ; include the relative time since the start of the application in
234
-	 * ; milliseconds, followed by the level of the log request,
235
-	 * ; followed by the two rightmost components of the logger name,
236
-	 * ; followed by the callers method name, followed by the line number,
237
-	 * ; the nested disgnostic context and finally the message itself.
238
-	 * ; Refer to the documentation of LoggerPatternLayout} for further information
239
-	 * ; on the syntax of the ConversionPattern key.
240
-	 * log4php.appender.A1.layout=LoggerPatternLayout
241
-	 * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
242
-	 * 
243
-	 * ; Set options for appender named "A2"
244
-	 * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
245
-	 * ; using at most one backup file. A2's layout is TTCC, using the
246
-	 * ; ISO8061 date format with context printing enabled.
247
-	 * log4php.appender.A2=LoggerAppenderRollingFile
248
-	 * log4php.appender.A2.MaxFileSize=10MB
249
-	 * log4php.appender.A2.MaxBackupIndex=1
250
-	 * log4php.appender.A2.layout=LoggerLayoutTTCC
251
-	 * log4php.appender.A2.layout.ContextPrinting="true"
252
-	 * log4php.appender.A2.layout.DateFormat="%c"
253
-	 * 
254
-	 * ; Root logger set to DEBUG using the A2 appender defined above.
255
-	 * log4php.rootLogger=DEBUG, A2
256
-	 * 
257
-	 * ; Logger definitions:
258
-	 * ; The SECURITY logger inherits is level from root. However, it's output
259
-	 * ; will go to A1 appender defined above. It's additivity is non-cumulative.
260
-	 * log4php.logger.SECURITY=INHERIT, A1
261
-	 * log4php.additivity.SECURITY=false
262
-	 * 
263
-	 * ; Only warnings or above will be logged for the logger "SECURITY.access".
264
-	 * ; Output will go to A1.
265
-	 * log4php.logger.SECURITY.access=WARN
266
-	 * 
267
-	 * 
268
-	 * ; The logger "class.of.the.day" inherits its level from the
269
-	 * ; logger hierarchy.	Output will go to the appender's of the root
270
-	 * ; logger, A2 in this case.
271
-	 * log4php.logger.class.of.the.day=INHERIT
272
-	 * </pre>
273
-	 * 
274
-	 * <p>Refer to the <b>setOption</b> method in each Appender and
275
-	 * Layout for class specific options.</p>
276
-	 * 
277
-	 * <p>Use the <b>&quot;;&quot;</b> character at the
278
-	 * beginning of a line for comments.</p>
279
-	 * 
280
-	 * @param string $url The name of the configuration file where the
281
-	 *					  configuration information is stored.
282
-	 * @param LoggerHierarchy $repository the repository to apply the configuration
283
-	 */
284
-	public function configure(LoggerHierarchy $hierarchy, $url = '') {
285
-		$properties = @parse_ini_file($url);
286
-		if ($properties === false || count($properties) == 0) {
287
-			$error = error_get_last();
288
-		    throw new LoggerException("LoggerConfiguratorIni: ".$error['message']);
289
-		}
290
-		return $this->doConfigureProperties($properties, $hierarchy);
291
-	}
89
+    /**
90
+     * Read configuration from a file.
91
+     *
92
+     * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
93
+     * file.</p>
94
+     *
95
+     * <b>The existing configuration is not cleared nor reset.</b> 
96
+     * If you require a different behavior, then call 
97
+     * {@link  Logger::resetConfiguration()} 
98
+     * method before calling {@link doConfigure()}.
99
+     * 
100
+     * <p>The configuration file consists of statements in the format
101
+     * <b>key=value</b>. The syntax of different configuration
102
+     * elements are discussed below.
103
+     * 
104
+     * <p><b>Repository-wide threshold</b></p>
105
+     * 
106
+     * <p>The repository-wide threshold filters logging requests by level
107
+     * regardless of logger. The syntax is:
108
+     * 
109
+     * <pre>
110
+     * log4php.threshold=[level]
111
+     * </pre>
112
+     * 
113
+     * <p>The level value can consist of the string values OFF, FATAL,
114
+     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
115
+     * custom level value can be specified in the form
116
+     * <samp>level#classname</samp>. By default the repository-wide threshold is set
117
+     * to the lowest possible value, namely the level <b>ALL</b>.
118
+     * </p>
119
+     * 
120
+     * 
121
+     * <p><b>Appender configuration</b></p>
122
+     * 
123
+     * <p>Appender configuration syntax is:</p>
124
+     * <pre>
125
+     * ; For appender named <i>appenderName</i>, set its class.
126
+     * ; Note: The appender name can contain dots.
127
+     * log4php.appender.appenderName=name_of_appender_class
128
+     * 
129
+     * ; Set appender specific options.
130
+     * 
131
+     * log4php.appender.appenderName.option1=value1
132
+     * log4php.appender.appenderName.optionN=valueN
133
+     * </pre>
134
+     * 
135
+     * For each named appender you can configure its {@link LoggerLayout}. The
136
+     * syntax for configuring an appender's layout is:
137
+     * <pre>
138
+     * log4php.appender.appenderName.layout=name_of_layout_class
139
+     * log4php.appender.appenderName.layout.option1=value1
140
+     *	....
141
+     * log4php.appender.appenderName.layout.optionN=valueN
142
+     * </pre>
143
+     * 
144
+     * <p><b>Configuring loggers</b></p>
145
+     * 
146
+     * <p>The syntax for configuring the root logger is:
147
+     * <pre>
148
+     * log4php.rootLogger=[level], appenderName, appenderName, ...
149
+     * </pre>
150
+     * 
151
+     * <p>This syntax means that an optional <i>level</i> can be
152
+     * supplied followed by appender names separated by commas.
153
+     * 
154
+     * <p>The level value can consist of the string values OFF, FATAL,
155
+     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
156
+     * custom level value can be specified in the form</p>
157
+     *
158
+     * <pre>level#classname</pre>
159
+     * 
160
+     * <p>If a level value is specified, then the root level is set
161
+     * to the corresponding level.	If no level value is specified,
162
+     * then the root level remains untouched.
163
+     * 
164
+     * <p>The root logger can be assigned multiple appenders.
165
+     * 
166
+     * <p>Each <i>appenderName</i> (separated by commas) will be added to
167
+     * the root logger. The named appender is defined using the
168
+     * appender syntax defined above.
169
+     * 
170
+     * <p>For non-root categories the syntax is almost the same:
171
+     * <pre>
172
+     * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
173
+     * </pre>
174
+     * 
175
+     * <p>The meaning of the optional level value is discussed above
176
+     * in relation to the root logger. In addition however, the value
177
+     * INHERITED can be specified meaning that the named logger should
178
+     * inherit its level from the logger hierarchy.</p>
179
+     * 
180
+     * <p>If no level value is supplied, then the level of the
181
+     * named logger remains untouched.</p>
182
+     * 
183
+     * <p>By default categories inherit their level from the
184
+     * hierarchy. However, if you set the level of a logger and later
185
+     * decide that that logger should inherit its level, then you should
186
+     * specify INHERITED as the value for the level value. NULL is a
187
+     * synonym for INHERITED.</p>
188
+     * 
189
+     * <p>Similar to the root logger syntax, each <i>appenderName</i>
190
+     * (separated by commas) will be attached to the named logger.</p>
191
+     * 
192
+     * <p>See the <i>appender additivity rule</i> in the user manual for 
193
+     * the meaning of the <b>additivity</b> flag.
194
+     * 
195
+     * <p><b>ObjectRenderers</b></p>
196
+     * 
197
+     * <p>You can customize the way message objects of a given type are
198
+     * converted to String before being logged. This is done by
199
+     * specifying a {@link LoggerRendererObject}
200
+     * for the object type would like to customize.</p>
201
+     * 
202
+     * <p>The syntax is:
203
+     * 
204
+     * <pre>
205
+     * log4php.renderer.name_of_rendered_class=name_of_rendering.class
206
+     * </pre>
207
+     * 
208
+     * As in,
209
+     * <pre>
210
+     * log4php.renderer.myFruit=myFruitRenderer
211
+     * </pre>
212
+     * 
213
+     * <p><b>Logger Factories</b></p>
214
+     * 
215
+     * The usage of custom logger factories is discouraged and no longer
216
+     * documented.
217
+     * 
218
+     * <p><b>Example</b></p>
219
+     * 
220
+     * <p>An example configuration is given below. Other configuration
221
+     * file examples are given in the <b>tests</b> folder.
222
+     * 
223
+     * <pre>
224
+     * ; Set options for appender named "A1".
225
+     * ; Appender "A1" will be a LoggerAppenderSyslog
226
+     * log4php.appender.A1=LoggerAppenderSyslog
227
+     * 
228
+     * ; The syslog daemon resides on www.abc.net
229
+     * log4php.appender.A1.ident=log4php-test
230
+     * 
231
+     * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
232
+     * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
233
+     * ; include the relative time since the start of the application in
234
+     * ; milliseconds, followed by the level of the log request,
235
+     * ; followed by the two rightmost components of the logger name,
236
+     * ; followed by the callers method name, followed by the line number,
237
+     * ; the nested disgnostic context and finally the message itself.
238
+     * ; Refer to the documentation of LoggerPatternLayout} for further information
239
+     * ; on the syntax of the ConversionPattern key.
240
+     * log4php.appender.A1.layout=LoggerPatternLayout
241
+     * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
242
+     * 
243
+     * ; Set options for appender named "A2"
244
+     * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
245
+     * ; using at most one backup file. A2's layout is TTCC, using the
246
+     * ; ISO8061 date format with context printing enabled.
247
+     * log4php.appender.A2=LoggerAppenderRollingFile
248
+     * log4php.appender.A2.MaxFileSize=10MB
249
+     * log4php.appender.A2.MaxBackupIndex=1
250
+     * log4php.appender.A2.layout=LoggerLayoutTTCC
251
+     * log4php.appender.A2.layout.ContextPrinting="true"
252
+     * log4php.appender.A2.layout.DateFormat="%c"
253
+     * 
254
+     * ; Root logger set to DEBUG using the A2 appender defined above.
255
+     * log4php.rootLogger=DEBUG, A2
256
+     * 
257
+     * ; Logger definitions:
258
+     * ; The SECURITY logger inherits is level from root. However, it's output
259
+     * ; will go to A1 appender defined above. It's additivity is non-cumulative.
260
+     * log4php.logger.SECURITY=INHERIT, A1
261
+     * log4php.additivity.SECURITY=false
262
+     * 
263
+     * ; Only warnings or above will be logged for the logger "SECURITY.access".
264
+     * ; Output will go to A1.
265
+     * log4php.logger.SECURITY.access=WARN
266
+     * 
267
+     * 
268
+     * ; The logger "class.of.the.day" inherits its level from the
269
+     * ; logger hierarchy.	Output will go to the appender's of the root
270
+     * ; logger, A2 in this case.
271
+     * log4php.logger.class.of.the.day=INHERIT
272
+     * </pre>
273
+     * 
274
+     * <p>Refer to the <b>setOption</b> method in each Appender and
275
+     * Layout for class specific options.</p>
276
+     * 
277
+     * <p>Use the <b>&quot;;&quot;</b> character at the
278
+     * beginning of a line for comments.</p>
279
+     * 
280
+     * @param string $url The name of the configuration file where the
281
+     *					  configuration information is stored.
282
+     * @param LoggerHierarchy $repository the repository to apply the configuration
283
+     */
284
+    public function configure(LoggerHierarchy $hierarchy, $url = '') {
285
+        $properties = @parse_ini_file($url);
286
+        if ($properties === false || count($properties) == 0) {
287
+            $error = error_get_last();
288
+            throw new LoggerException("LoggerConfiguratorIni: ".$error['message']);
289
+        }
290
+        return $this->doConfigureProperties($properties, $hierarchy);
291
+    }
292 292
 
293
-	/**
294
-	 * Read configuration options from <b>properties</b>.
295
-	 *
296
-	 * @see doConfigure().
297
-	 * @param array $properties
298
-	 * @param LoggerHierarchy $hierarchy
299
-	 */
300
-	private function doConfigureProperties($properties, LoggerHierarchy $hierarchy) {
301
-		$thresholdStr = @$properties[self::THRESHOLD_PREFIX];
302
-		$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
303
-		$this->configureRootCategory($properties, $hierarchy);
304
-		$this->parseCatsAndRenderers($properties, $hierarchy);
305
-		return true;
306
-	}
293
+    /**
294
+     * Read configuration options from <b>properties</b>.
295
+     *
296
+     * @see doConfigure().
297
+     * @param array $properties
298
+     * @param LoggerHierarchy $hierarchy
299
+     */
300
+    private function doConfigureProperties($properties, LoggerHierarchy $hierarchy) {
301
+        $thresholdStr = @$properties[self::THRESHOLD_PREFIX];
302
+        $hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
303
+        $this->configureRootCategory($properties, $hierarchy);
304
+        $this->parseCatsAndRenderers($properties, $hierarchy);
305
+        return true;
306
+    }
307 307
 
308
-	/**
309
-	 * @param array $props array of properties
310
-	 * @param LoggerHierarchy $hierarchy
311
-	 */
312
-	private function configureRootCategory($props, LoggerHierarchy $hierarchy) {
313
-		$effectivePrefix = self::ROOT_LOGGER_PREFIX;
314
-		$value = @$props[self::ROOT_LOGGER_PREFIX];
308
+    /**
309
+     * @param array $props array of properties
310
+     * @param LoggerHierarchy $hierarchy
311
+     */
312
+    private function configureRootCategory($props, LoggerHierarchy $hierarchy) {
313
+        $effectivePrefix = self::ROOT_LOGGER_PREFIX;
314
+        $value = @$props[self::ROOT_LOGGER_PREFIX];
315 315
 
316
-		if(empty($value)) {
317
-			$value = @$props[self::ROOT_CATEGORY_PREFIX];
318
-			$effectivePrefix = self::ROOT_CATEGORY_PREFIX;
319
-		}
316
+        if(empty($value)) {
317
+            $value = @$props[self::ROOT_CATEGORY_PREFIX];
318
+            $effectivePrefix = self::ROOT_CATEGORY_PREFIX;
319
+        }
320 320
 
321
-		if(empty($value)) {
322
-			// TODO "Could not find root logger information. Is this OK?"
323
-		} else {
324
-			$root = $hierarchy->getRootLogger();
325
-			$this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
326
-		}
327
-	}
321
+        if(empty($value)) {
322
+            // TODO "Could not find root logger information. Is this OK?"
323
+        } else {
324
+            $root = $hierarchy->getRootLogger();
325
+            $this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
326
+        }
327
+    }
328 328
 
329
-	/**
330
-	 * Parse non-root elements, such non-root categories and renderers.
331
-	 *
332
-	 * @param array $props array of properties
333
-	 * @param LoggerHierarchy $hierarchy
334
-	 */
335
-	private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
336
-		while(list($key,$value) = each($props)) {
337
-			if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
338
-				strpos($key, self::LOGGER_PREFIX) === 0) {
339
-				if(strpos($key, self::CATEGORY_PREFIX) === 0) {
340
-					$loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
341
-				} else if(strpos($key, self::LOGGER_PREFIX) === 0) {
342
-					$loggerName = substr($key, strlen(self::LOGGER_PREFIX));
343
-				}
329
+    /**
330
+     * Parse non-root elements, such non-root categories and renderers.
331
+     *
332
+     * @param array $props array of properties
333
+     * @param LoggerHierarchy $hierarchy
334
+     */
335
+    private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
336
+        while(list($key,$value) = each($props)) {
337
+            if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
338
+                strpos($key, self::LOGGER_PREFIX) === 0) {
339
+                if(strpos($key, self::CATEGORY_PREFIX) === 0) {
340
+                    $loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
341
+                } else if(strpos($key, self::LOGGER_PREFIX) === 0) {
342
+                    $loggerName = substr($key, strlen(self::LOGGER_PREFIX));
343
+                }
344 344
 				
345
-				$logger = $hierarchy->getLogger($loggerName);
346
-				$this->parseCategory($props, $logger, $key, $loggerName, $value);
347
-				$this->parseAdditivityForLogger($props, $logger, $loggerName);
348
-			} else if(strpos($key, self::RENDERER_PREFIX) === 0) {
349
-				$renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
350
-				$renderingClass = $value;
351
-				$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
352
-			}
353
-		}
354
-	}
345
+                $logger = $hierarchy->getLogger($loggerName);
346
+                $this->parseCategory($props, $logger, $key, $loggerName, $value);
347
+                $this->parseAdditivityForLogger($props, $logger, $loggerName);
348
+            } else if(strpos($key, self::RENDERER_PREFIX) === 0) {
349
+                $renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
350
+                $renderingClass = $value;
351
+                $hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
352
+            }
353
+        }
354
+    }
355 355
 
356
-	/**
357
-	 * Parse the additivity option for a non-root category.
358
-	 *
359
-	 * @param array $props array of properties
360
-	 * @param Logger $cat
361
-	 * @param string $loggerName
362
-	 */
363
-	private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
364
-		$value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
356
+    /**
357
+     * Parse the additivity option for a non-root category.
358
+     *
359
+     * @param array $props array of properties
360
+     * @param Logger $cat
361
+     * @param string $loggerName
362
+     */
363
+    private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
364
+        $value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
365 365
 		
366
-		// touch additivity only if necessary
367
-		if(!empty($value)) {
368
-			$additivity = LoggerOptionConverter::toBoolean($value, true);
369
-			$cat->setAdditivity($additivity);
370
-		}
371
-	}
366
+        // touch additivity only if necessary
367
+        if(!empty($value)) {
368
+            $additivity = LoggerOptionConverter::toBoolean($value, true);
369
+            $cat->setAdditivity($additivity);
370
+        }
371
+    }
372 372
 
373
-	/**
374
-	 * This method must work for the root category as well.
375
-	 *
376
-	 * @param array $props array of properties
377
-	 * @param Logger $logger
378
-	 * @param string $optionKey
379
-	 * @param string $loggerName
380
-	 * @param string $value
381
-	 * @return Logger
382
-	 */
383
-	private function parseCategory($props, Logger $logger, $optionKey, $loggerName, $value) {
384
-		// We must skip over ',' but not white space
385
-		$st = explode(',', $value);
373
+    /**
374
+     * This method must work for the root category as well.
375
+     *
376
+     * @param array $props array of properties
377
+     * @param Logger $logger
378
+     * @param string $optionKey
379
+     * @param string $loggerName
380
+     * @param string $value
381
+     * @return Logger
382
+     */
383
+    private function parseCategory($props, Logger $logger, $optionKey, $loggerName, $value) {
384
+        // We must skip over ',' but not white space
385
+        $st = explode(',', $value);
386 386
 
387
-		// If value is not in the form ", appender.." or "", then we should set
388
-		// the level of the loggeregory.
387
+        // If value is not in the form ", appender.." or "", then we should set
388
+        // the level of the loggeregory.
389 389
 
390
-		if(!(empty($value) || @$value[0] == ',')) {
391
-			// just to be on the safe side...
392
-			if(count($st) == 0) {
393
-				return;
394
-			}
395
-			$levelStr = current($st);
390
+        if(!(empty($value) || @$value[0] == ',')) {
391
+            // just to be on the safe side...
392
+            if(count($st) == 0) {
393
+                return;
394
+            }
395
+            $levelStr = current($st);
396 396
 			
397
-			// If the level value is inherited, set category level value to
398
-			// null. We also check that the user has not specified inherited for the
399
-			// root category.
400
-			if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
-				if($loggerName == self::INTERNAL_ROOT_NAME) {
402
-					// TODO: throw exception?	"The root logger cannot be set to null."
403
-				} else {
404
-					$logger->setLevel(null);
405
-				}
406
-			} else {
407
-				$logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
408
-			}
409
-		}
397
+            // If the level value is inherited, set category level value to
398
+            // null. We also check that the user has not specified inherited for the
399
+            // root category.
400
+            if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
+                if($loggerName == self::INTERNAL_ROOT_NAME) {
402
+                    // TODO: throw exception?	"The root logger cannot be set to null."
403
+                } else {
404
+                    $logger->setLevel(null);
405
+                }
406
+            } else {
407
+                $logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
408
+            }
409
+        }
410 410
 
411
-		// TODO: removing should be done by the logger, if necessary and wanted 
412
-		// $logger->removeAllAppenders();
413
-		while($appenderName = next($st)) {
414
-			$appenderName = trim($appenderName);
415
-			if(empty($appenderName)) {
416
-				continue;
417
-			}
411
+        // TODO: removing should be done by the logger, if necessary and wanted 
412
+        // $logger->removeAllAppenders();
413
+        while($appenderName = next($st)) {
414
+            $appenderName = trim($appenderName);
415
+            if(empty($appenderName)) {
416
+                continue;
417
+            }
418 418
 			
419
-			$appender = $this->parseAppender($props, $appenderName);
420
-			if($appender !== null) {
421
-					$logger->addAppender($appender);
422
-			}
423
-		}
424
-	}
419
+            $appender = $this->parseAppender($props, $appenderName);
420
+            if($appender !== null) {
421
+                    $logger->addAppender($appender);
422
+            }
423
+        }
424
+    }
425 425
 
426
-	/**
427
-	 * @param array $props array of properties
428
-	 * @param string $appenderName
429
-	 * @return LoggerAppender
430
-	 */
431
-	private function parseAppender($props, $appenderName) {
432
-		$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
433
-		$prefix = self::APPENDER_PREFIX . $appenderName;
434
-		if($appender === null) {
435
-			// Appender was not previously initialized.
436
-			$appenderClass = @$props[$prefix];
437
-			$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
438
-			if($appender === null) {
439
-				return null;
440
-			}
441
-		}
426
+    /**
427
+     * @param array $props array of properties
428
+     * @param string $appenderName
429
+     * @return LoggerAppender
430
+     */
431
+    private function parseAppender($props, $appenderName) {
432
+        $appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
433
+        $prefix = self::APPENDER_PREFIX . $appenderName;
434
+        if($appender === null) {
435
+            // Appender was not previously initialized.
436
+            $appenderClass = @$props[$prefix];
437
+            $appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
438
+            if($appender === null) {
439
+                return null;
440
+            }
441
+        }
442 442
 		
443
-		if($appender->requiresLayout() ) {
444
-			$layoutPrefix = $prefix . ".layout";
445
-			$layoutClass = @$props[$layoutPrefix];
446
-			$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
447
-			if(empty($layoutClass)) {
448
-				$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
449
-			} else {
450
-				$layout = LoggerReflectionUtils::createObject($layoutClass);
451
-				if($layout === null) {
452
-					$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
453
-				}
454
-			}
443
+        if($appender->requiresLayout() ) {
444
+            $layoutPrefix = $prefix . ".layout";
445
+            $layoutClass = @$props[$layoutPrefix];
446
+            $layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
447
+            if(empty($layoutClass)) {
448
+                $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
449
+            } else {
450
+                $layout = LoggerReflectionUtils::createObject($layoutClass);
451
+                if($layout === null) {
452
+                    $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
453
+                }
454
+            }
455 455
 			
456
-			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
457
-			$appender->setLayout($layout);
456
+            LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
457
+            $appender->setLayout($layout);
458 458
 			
459
-		}
460
-		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
461
-		return $appender;		 
462
-	}
459
+        }
460
+        LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
461
+        return $appender;		 
462
+    }
463 463
 }
Please login to merge, or discard this patch.
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.
Indentation   +65 added lines, -65 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
  * A flexible layout configurable with pattern string.
@@ -136,61 +136,61 @@  discard block
 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.
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.
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.
Indentation   +549 added lines, -549 removed lines patch added patch discarded remove patch
@@ -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.
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.
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.
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -33,224 +33,224 @@
 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.
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.