Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerBasicPatternConverter.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -24,48 +24,48 @@
 block discarded – undo
24 24
  */
25 25
 class LoggerBasicPatternConverter extends LoggerPatternConverter {
26 26
 
27
-	/**
28
-	 * @var integer
29
-	 */
30
-	private $type;
27
+    /**
28
+     * @var integer
29
+     */
30
+    private $type;
31 31
 
32
-	/**
33
-	 * Constructor
34
-	 *
35
-	 * @param string $formattingInfo
36
-	 * @param integer $type
37
-	 */
38
-	public function __construct($formattingInfo, $type) {
39
-	  parent::__construct($formattingInfo);
40
-	  $this->type = $type;
41
-	}
32
+    /**
33
+     * Constructor
34
+     *
35
+     * @param string $formattingInfo
36
+     * @param integer $type
37
+     */
38
+    public function __construct($formattingInfo, $type) {
39
+        parent::__construct($formattingInfo);
40
+        $this->type = $type;
41
+    }
42 42
 
43
-	/**
44
-	 * @param LoggerLoggingEvent $event
45
-	 * @return string
46
-	 */
47
-	public function convert($event) {
48
-		switch($this->type) {
49
-			case LoggerPatternParser::RELATIVE_TIME_CONVERTER:
50
-				$timeStamp = $event->getTimeStamp();
51
-				$startTime = LoggerLoggingEvent::getStartTime();
52
-				return (string)(int)($timeStamp * 1000 - $startTime * 1000);
43
+    /**
44
+     * @param LoggerLoggingEvent $event
45
+     * @return string
46
+     */
47
+    public function convert($event) {
48
+        switch($this->type) {
49
+            case LoggerPatternParser::RELATIVE_TIME_CONVERTER:
50
+                $timeStamp = $event->getTimeStamp();
51
+                $startTime = LoggerLoggingEvent::getStartTime();
52
+                return (string)(int)($timeStamp * 1000 - $startTime * 1000);
53 53
 				
54
-			case LoggerPatternParser::THREAD_CONVERTER:
55
-				return $event->getThreadName();
54
+            case LoggerPatternParser::THREAD_CONVERTER:
55
+                return $event->getThreadName();
56 56
 
57
-			case LoggerPatternParser::LEVEL_CONVERTER:
58
-				$level = $event->getLevel();
59
-				return $level->toString();
57
+            case LoggerPatternParser::LEVEL_CONVERTER:
58
+                $level = $event->getLevel();
59
+                return $level->toString();
60 60
 
61
-			case LoggerPatternParser::NDC_CONVERTER:
62
-				return $event->getNDC();
61
+            case LoggerPatternParser::NDC_CONVERTER:
62
+                return $event->getNDC();
63 63
 
64
-			case LoggerPatternParser::MESSAGE_CONVERTER:
65
-				return $event->getRenderedMessage();
64
+            case LoggerPatternParser::MESSAGE_CONVERTER:
65
+                return $event->getRenderedMessage();
66 66
 				
67
-			default: 
68
-				return '';
69
-		}
70
-	}
67
+            default: 
68
+                return '';
69
+        }
70
+    }
71 71
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerFormattingInfo.php 1 patch
Indentation   +33 added lines, -33 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
  * This class encapsulates the information obtained when parsing
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class LoggerFormattingInfo {
30 30
 
31
-	public $min = -1;
32
-	public $max = 0x7FFFFFFF;
33
-	public $leftAlign = false;
31
+    public $min = -1;
32
+    public $max = 0x7FFFFFFF;
33
+    public $leftAlign = false;
34 34
 
35
-	/**
36
-	 * Constructor
37
-	 */
38
-	public function __construct() {}
35
+    /**
36
+     * Constructor
37
+     */
38
+    public function __construct() {}
39 39
 	
40
-	public function reset() {
41
-		$this->min = -1;
42
-		$this->max = 0x7FFFFFFF;
43
-		$this->leftAlign = false;	  
44
-	}
40
+    public function reset() {
41
+        $this->min = -1;
42
+        $this->max = 0x7FFFFFFF;
43
+        $this->leftAlign = false;	  
44
+    }
45 45
 
46
-	public function dump() {
47
-		// TODO: other option to dump?
48
-		// LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
49
-	}
46
+    public function dump() {
47
+        // TODO: other option to dump?
48
+        // LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
49
+    }
50 50
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerOptionConverter.php 1 patch
Indentation   +269 added lines, -269 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 convenience class to convert property values to specific types.
@@ -29,193 +29,193 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class LoggerOptionConverter {
31 31
 
32
-	const DELIM_START = '${';
33
-	const DELIM_STOP = '}';
34
-	const DELIM_START_LEN = 2;
35
-	const DELIM_STOP_LEN = 1;
32
+    const DELIM_START = '${';
33
+    const DELIM_STOP = '}';
34
+    const DELIM_START_LEN = 2;
35
+    const DELIM_STOP_LEN = 1;
36 36
 
37
-   /**
38
-	* Read a predefined var.
39
-	*
40
-	* It returns a value referenced by <var>$key</var> using this search criteria:
41
-	* - if <var>$key</var> is a constant then return it. Else
42
-	* - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
43
-	* - return <var>$def</var>. 
44
-	*
45
-	* @param string $key The key to search for.
46
-	* @param string $def The default value to return.
47
-	* @return string	the string value of the system property, or the default
48
-	*					value if there is no property with that key.
49
-	*
50
-	* @static
51
-	*/
52
-	public static function getSystemProperty($key, $def) {
53
-		if(defined($key)) {
54
-			return (string)constant($key);
55
-		} else if(isset($_SERVER[$key])) {
56
-			return (string)$_SERVER[$key];
57
-		} else if(isset($_ENV[$key])) {
58
-			return (string)$_ENV[$key];
59
-		} else {
60
-			return $def;
61
-		}
62
-	}
37
+    /**
38
+     * Read a predefined var.
39
+     *
40
+     * It returns a value referenced by <var>$key</var> using this search criteria:
41
+     * - if <var>$key</var> is a constant then return it. Else
42
+     * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
43
+     * - return <var>$def</var>. 
44
+     *
45
+     * @param string $key The key to search for.
46
+     * @param string $def The default value to return.
47
+     * @return string	the string value of the system property, or the default
48
+     *					value if there is no property with that key.
49
+     *
50
+     * @static
51
+     */
52
+    public static function getSystemProperty($key, $def) {
53
+        if(defined($key)) {
54
+            return (string)constant($key);
55
+        } else if(isset($_SERVER[$key])) {
56
+            return (string)$_SERVER[$key];
57
+        } else if(isset($_ENV[$key])) {
58
+            return (string)$_ENV[$key];
59
+        } else {
60
+            return $def;
61
+        }
62
+    }
63 63
 
64
-	/**
65
-	 * If <var>$value</var> is <i>true</i>, then <i>true</i> is
66
-	 * returned. If <var>$value</var> is <i>false</i>, then
67
-	 * <i>true</i> is returned. Otherwise, <var>$default</var> is
68
-	 * returned.
69
-	 *
70
-	 * <p>Case of value is unimportant.</p>
71
-	 *
72
-	 * @param string $value
73
-	 * @param boolean $default
74
-	 * @return boolean
75
-	 *
76
-	 * @static
77
-	 */
78
-	public static function toBoolean($value, $default=true) {
79
-	    if (is_null($value)) {
80
-			return $default;
81
-	    } elseif (is_string($value)) {
82
-		$trimmedVal = strtolower(trim($value));
64
+    /**
65
+     * If <var>$value</var> is <i>true</i>, then <i>true</i> is
66
+     * returned. If <var>$value</var> is <i>false</i>, then
67
+     * <i>true</i> is returned. Otherwise, <var>$default</var> is
68
+     * returned.
69
+     *
70
+     * <p>Case of value is unimportant.</p>
71
+     *
72
+     * @param string $value
73
+     * @param boolean $default
74
+     * @return boolean
75
+     *
76
+     * @static
77
+     */
78
+    public static function toBoolean($value, $default=true) {
79
+        if (is_null($value)) {
80
+            return $default;
81
+        } elseif (is_string($value)) {
82
+        $trimmedVal = strtolower(trim($value));
83 83
 	
84 84
             if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
85
-			return true;
85
+            return true;
86 86
             } else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
87
-			return false;
88
-		}
89
-		} elseif (is_bool($value)) {
90
-		    return $value;
91
-		} elseif (is_int($value)) {
92
-		    return !($value == 0); // true is everything but 0 like in C 
93
-		}
87
+            return false;
88
+        }
89
+        } elseif (is_bool($value)) {
90
+            return $value;
91
+        } elseif (is_int($value)) {
92
+            return !($value == 0); // true is everything but 0 like in C 
93
+        }
94 94
 		
95
-		trigger_error("Could not convert ".var_export($value,1)." to boolean!", E_USER_WARNING);
96
-		return $default;
97
-	}
95
+        trigger_error("Could not convert ".var_export($value,1)." to boolean!", E_USER_WARNING);
96
+        return $default;
97
+    }
98 98
 
99
-	/**
100
-	 * @param string $value
101
-	 * @param integer $default
102
-	 * @return integer
103
-	 * @static
104
-	 */
105
-	public static function toInt($value, $default) {
106
-		$value = trim($value);
107
-		if(is_numeric($value)) {
108
-			return (int)$value;
109
-		} else {
110
-			return $default;
111
-		}
112
-	}
99
+    /**
100
+     * @param string $value
101
+     * @param integer $default
102
+     * @return integer
103
+     * @static
104
+     */
105
+    public static function toInt($value, $default) {
106
+        $value = trim($value);
107
+        if(is_numeric($value)) {
108
+            return (int)$value;
109
+        } else {
110
+            return $default;
111
+        }
112
+    }
113 113
 
114
-	/**
115
-	 * Converts a standard or custom priority level to a Level
116
-	 * object.
117
-	 *
118
-	 * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
119
-	 * where <i>full_file_classname</i> means the class filename with path
120
-	 * but without php extension, then the specified class' <i>toLevel()</i> method
121
-	 * is called to process the specified level string; if no '#'
122
-	 * character is present, then the default {@link LoggerLevel}
123
-	 * class is used to process the level value.</p>
124
-	 *
125
-	 * <p>As a special case, if the <var>$value</var> parameter is
126
-	 * equal to the string "NULL", then the value <i>null</i> will
127
-	 * be returned.</p>
128
-	 *
129
-	 * <p>If any error occurs while converting the value to a level,
130
-	 * the <var>$defaultValue</var> parameter, which may be
131
-	 * <i>null</i>, is returned.</p>
132
-	 *
133
-	 * <p>Case of <var>$value</var> is insignificant for the level level, but is
134
-	 * significant for the class name part, if present.</p>
135
-	 *
136
-	 * @param string $value
137
-	 * @param LoggerLevel $defaultValue
138
-	 * @return LoggerLevel a {@link LoggerLevel} or null
139
-	 * @static
140
-	 */
141
-	public static function toLevel($value, $defaultValue) {
142
-		if($value === null) {
143
-			return $defaultValue;
144
-		}
145
-		$hashIndex = strpos($value, '#');
146
-		if($hashIndex === false) {
147
-			if("NULL" == strtoupper($value)) {
148
-				return null;
149
-			} else {
150
-				// no class name specified : use standard Level class
151
-				return LoggerLevel::toLevel($value, $defaultValue);
152
-			}
153
-		}
114
+    /**
115
+     * Converts a standard or custom priority level to a Level
116
+     * object.
117
+     *
118
+     * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
119
+     * where <i>full_file_classname</i> means the class filename with path
120
+     * but without php extension, then the specified class' <i>toLevel()</i> method
121
+     * is called to process the specified level string; if no '#'
122
+     * character is present, then the default {@link LoggerLevel}
123
+     * class is used to process the level value.</p>
124
+     *
125
+     * <p>As a special case, if the <var>$value</var> parameter is
126
+     * equal to the string "NULL", then the value <i>null</i> will
127
+     * be returned.</p>
128
+     *
129
+     * <p>If any error occurs while converting the value to a level,
130
+     * the <var>$defaultValue</var> parameter, which may be
131
+     * <i>null</i>, is returned.</p>
132
+     *
133
+     * <p>Case of <var>$value</var> is insignificant for the level level, but is
134
+     * significant for the class name part, if present.</p>
135
+     *
136
+     * @param string $value
137
+     * @param LoggerLevel $defaultValue
138
+     * @return LoggerLevel a {@link LoggerLevel} or null
139
+     * @static
140
+     */
141
+    public static function toLevel($value, $defaultValue) {
142
+        if($value === null) {
143
+            return $defaultValue;
144
+        }
145
+        $hashIndex = strpos($value, '#');
146
+        if($hashIndex === false) {
147
+            if("NULL" == strtoupper($value)) {
148
+                return null;
149
+            } else {
150
+                // no class name specified : use standard Level class
151
+                return LoggerLevel::toLevel($value, $defaultValue);
152
+            }
153
+        }
154 154
 
155
-		$result = $defaultValue;
155
+        $result = $defaultValue;
156 156
 
157
-		$clazz = substr($value, ($hashIndex + 1));
158
-		$levelName = substr($value, 0, $hashIndex);
157
+        $clazz = substr($value, ($hashIndex + 1));
158
+        $levelName = substr($value, 0, $hashIndex);
159 159
 
160
-		// This is degenerate case but you never know.
161
-		if("NULL" == strtoupper($levelName)) {
162
-			return null;
163
-		}
160
+        // This is degenerate case but you never know.
161
+        if("NULL" == strtoupper($levelName)) {
162
+            return null;
163
+        }
164 164
 
165
-		$clazz = basename($clazz);
165
+        $clazz = basename($clazz);
166 166
 
167
-		if(class_exists($clazz)) {
168
-			$result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
169
-			if(!$result instanceof LoggerLevel) {
170
-				$result = $defaultValue;
171
-			}
172
-		} 
173
-		return $result;
174
-	}
167
+        if(class_exists($clazz)) {
168
+            $result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
169
+            if(!$result instanceof LoggerLevel) {
170
+                $result = $defaultValue;
171
+            }
172
+        } 
173
+        return $result;
174
+    }
175 175
 
176
-	/**
177
-	 * @param string $value
178
-	 * @param float $default
179
-	 * @return float
180
-	 *
181
-	 * @static
182
-	 */
183
-	public static function toFileSize($value, $default) {
184
-		if($value === null) {
185
-			return $default;
186
-		}
176
+    /**
177
+     * @param string $value
178
+     * @param float $default
179
+     * @return float
180
+     *
181
+     * @static
182
+     */
183
+    public static function toFileSize($value, $default) {
184
+        if($value === null) {
185
+            return $default;
186
+        }
187 187
 
188
-		$s = strtoupper(trim($value));
189
-		$multiplier = (float)1;
190
-		if(($index = strpos($s, 'KB')) !== false) {
191
-			$multiplier = 1024;
192
-			$s = substr($s, 0, $index);
193
-		} else if(($index = strpos($s, 'MB')) !== false) {
194
-			$multiplier = 1024 * 1024;
195
-			$s = substr($s, 0, $index);
196
-		} else if(($index = strpos($s, 'GB')) !== false) {
197
-			$multiplier = 1024 * 1024 * 1024;
198
-			$s = substr($s, 0, $index);
199
-		}
200
-		if(is_numeric($s)) {
201
-			return (float)$s * $multiplier;
202
-		} 
203
-		return $default;
204
-	}
188
+        $s = strtoupper(trim($value));
189
+        $multiplier = (float)1;
190
+        if(($index = strpos($s, 'KB')) !== false) {
191
+            $multiplier = 1024;
192
+            $s = substr($s, 0, $index);
193
+        } else if(($index = strpos($s, 'MB')) !== false) {
194
+            $multiplier = 1024 * 1024;
195
+            $s = substr($s, 0, $index);
196
+        } else if(($index = strpos($s, 'GB')) !== false) {
197
+            $multiplier = 1024 * 1024 * 1024;
198
+            $s = substr($s, 0, $index);
199
+        }
200
+        if(is_numeric($s)) {
201
+            return (float)$s * $multiplier;
202
+        } 
203
+        return $default;
204
+    }
205 205
 
206
-	/**
207
-	 * Find the value corresponding to <var>$key</var> in
208
-	 * <var>$props</var>. Then perform variable substitution on the
209
-	 * found value.
210
-	 *
211
-	 * @param string $key
212
-	 * @param array $props
213
-	 * @return string
214
-	 *
215
-	 * @static
216
-	 */
217
-	public static function findAndSubst($key, $props) {
218
-		$value = @$props[$key];
206
+    /**
207
+     * Find the value corresponding to <var>$key</var> in
208
+     * <var>$props</var>. Then perform variable substitution on the
209
+     * found value.
210
+     *
211
+     * @param string $key
212
+     * @param array $props
213
+     * @return string
214
+     *
215
+     * @static
216
+     */
217
+    public static function findAndSubst($key, $props) {
218
+        $value = @$props[$key];
219 219
 
220 220
         // If coming from the LoggerConfiguratorIni, some options were
221 221
         // already mangled by parse_ini_file:
@@ -233,90 +233,90 @@  discard block
 block discarded – undo
233 233
         // explicitly set by the user and is different from an option which
234 234
         // has not been specified and therefore keeps its default value.
235 235
         //
236
-		// if(!empty($value)) {
237
-			return LoggerOptionConverter::substVars($value, $props);
238
-		// }
236
+        // if(!empty($value)) {
237
+            return LoggerOptionConverter::substVars($value, $props);
238
+        // }
239 239
     }
240 240
 
241
-	/**
242
-	 * Perform variable substitution in string <var>$val</var> from the
243
-	 * values of keys found with the {@link getSystemProperty()} method.
244
-	 * 
245
-	 * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
246
-	 * 
247
-	 * <p>For example, if the "MY_CONSTANT" contains "value", then
248
-	 * the call
249
-	 * <code>
250
-	 * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
251
-	 * </code>
252
-	 * will set the variable <i>$s</i> to "Value of key is value.".</p>
253
-	 * 
254
-	 * <p>If no value could be found for the specified key, then the
255
-	 * <var>$props</var> parameter is searched, if the value could not
256
-	 * be found there, then substitution defaults to the empty string.</p>
257
-	 * 
258
-	 * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
259
-	 * "inexistentKey", then the call
260
-	 * <code>
261
-	 * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
262
-	 * </code>
263
-	 * will set <var>$s</var> to "Value of inexistentKey is []".</p>
264
-	 * 
265
-	 * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
266
-	 * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
267
-	 * 
268
-	 * @author Avy Sharell
269
-	 * 
270
-	 * @param string $val The string on which variable substitution is performed.
271
-	 * @param array $props
272
-	 * @return string
273
-	 *
274
-	 * @static
275
-	 */
276
-	 // TODO: this method doesn't work correctly with key = true, it needs key = "true" which is odd
277
-	public static function substVars($val, $props = null) {
278
-		$sbuf = '';
279
-		$i = 0;
280
-		while(true) {
281
-			$j = strpos($val, self::DELIM_START, $i);
282
-			if($j === false) {
283
-				// no more variables
284
-				if($i == 0) { // this is a simple string
285
-					return $val;
286
-				} else { // add the tail string which contails no variables and return the result.
287
-					$sbuf .= substr($val, $i);
288
-					return $sbuf;
289
-				}
290
-			} else {
241
+    /**
242
+     * Perform variable substitution in string <var>$val</var> from the
243
+     * values of keys found with the {@link getSystemProperty()} method.
244
+     * 
245
+     * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
246
+     * 
247
+     * <p>For example, if the "MY_CONSTANT" contains "value", then
248
+     * the call
249
+     * <code>
250
+     * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
251
+     * </code>
252
+     * will set the variable <i>$s</i> to "Value of key is value.".</p>
253
+     * 
254
+     * <p>If no value could be found for the specified key, then the
255
+     * <var>$props</var> parameter is searched, if the value could not
256
+     * be found there, then substitution defaults to the empty string.</p>
257
+     * 
258
+     * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
259
+     * "inexistentKey", then the call
260
+     * <code>
261
+     * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
262
+     * </code>
263
+     * will set <var>$s</var> to "Value of inexistentKey is []".</p>
264
+     * 
265
+     * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
266
+     * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
267
+     * 
268
+     * @author Avy Sharell
269
+     * 
270
+     * @param string $val The string on which variable substitution is performed.
271
+     * @param array $props
272
+     * @return string
273
+     *
274
+     * @static
275
+     */
276
+        // TODO: this method doesn't work correctly with key = true, it needs key = "true" which is odd
277
+    public static function substVars($val, $props = null) {
278
+        $sbuf = '';
279
+        $i = 0;
280
+        while(true) {
281
+            $j = strpos($val, self::DELIM_START, $i);
282
+            if($j === false) {
283
+                // no more variables
284
+                if($i == 0) { // this is a simple string
285
+                    return $val;
286
+                } else { // add the tail string which contails no variables and return the result.
287
+                    $sbuf .= substr($val, $i);
288
+                    return $sbuf;
289
+                }
290
+            } else {
291 291
 			
292
-				$sbuf .= substr($val, $i, $j-$i);
293
-				$k = strpos($val, self::DELIM_STOP, $j);
294
-				if($k === false) {
295
-					// LoggerOptionConverter::substVars() has no closing brace. Opening brace
296
-					return '';
297
-				} else {
298
-					$j += self::START_LEN;
299
-					$key = substr($val, $j, $k - $j);
300
-					// first try in System properties
301
-					$replacement = LoggerOptionConverter::getSystemProperty($key, null);
302
-					// then try props parameter
303
-					if($replacement == null and $props !== null) {
304
-						$replacement = @$props[$key];
305
-					}
292
+                $sbuf .= substr($val, $i, $j-$i);
293
+                $k = strpos($val, self::DELIM_STOP, $j);
294
+                if($k === false) {
295
+                    // LoggerOptionConverter::substVars() has no closing brace. Opening brace
296
+                    return '';
297
+                } else {
298
+                    $j += self::START_LEN;
299
+                    $key = substr($val, $j, $k - $j);
300
+                    // first try in System properties
301
+                    $replacement = LoggerOptionConverter::getSystemProperty($key, null);
302
+                    // then try props parameter
303
+                    if($replacement == null and $props !== null) {
304
+                        $replacement = @$props[$key];
305
+                    }
306 306
 
307
-					if(!empty($replacement)) {
308
-						// Do variable substitution on the replacement string
309
-						// such that we can solve "Hello ${x2}" as "Hello p1" 
310
-						// the where the properties are
311
-						// x1=p1
312
-						// x2=${x1}
313
-						$recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
314
-						$sbuf .= $recursiveReplacement;
315
-					}
316
-					$i = $k + self::DELIM_STOP_LEN;
317
-				}
318
-			}
319
-		}
320
-	}
307
+                    if(!empty($replacement)) {
308
+                        // Do variable substitution on the replacement string
309
+                        // such that we can solve "Hello ${x2}" as "Hello p1" 
310
+                        // the where the properties are
311
+                        // x1=p1
312
+                        // x2=${x1}
313
+                        $recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
314
+                        $sbuf .= $recursiveReplacement;
315
+                    }
316
+                    $i = $k + self::DELIM_STOP_LEN;
317
+                }
318
+            }
319
+        }
320
+    }
321 321
 
322 322
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerLocationPatternConverter.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,40 +24,40 @@
 block discarded – undo
24 24
  */
25 25
 class LoggerLocationPatternConverter extends LoggerPatternConverter {
26 26
 	
27
-	/**
28
-	 * @var integer
29
-	 */
30
-	private $type;
27
+    /**
28
+     * @var integer
29
+     */
30
+    private $type;
31 31
 
32
-	/**
33
-	 * Constructor
34
-	 *
35
-	 * @param string $formattingInfo
36
-	 * @param integer $type
37
-	 */
38
-	public function __construct($formattingInfo, $type) {
39
-	  parent::__construct($formattingInfo);
40
-	  $this->type = $type;
41
-	}
32
+    /**
33
+     * Constructor
34
+     *
35
+     * @param string $formattingInfo
36
+     * @param integer $type
37
+     */
38
+    public function __construct($formattingInfo, $type) {
39
+        parent::__construct($formattingInfo);
40
+        $this->type = $type;
41
+    }
42 42
 
43
-	/**
44
-	 * @param LoggerLoggingEvent $event
45
-	 * @return string
46
-	 */
47
-	public function convert($event) {
48
-		$locationInfo = $event->getLocationInformation();
49
-		switch($this->type) {
50
-			case LoggerPatternParser::FULL_LOCATION_CONVERTER:
51
-				return $locationInfo->getFullInfo();
52
-			case LoggerPatternParser::METHOD_LOCATION_CONVERTER:
53
-				return $locationInfo->getMethodName();
54
-			case LoggerPatternParser::LINE_LOCATION_CONVERTER:
55
-				return $locationInfo->getLineNumber();
56
-			case LoggerPatternParser::FILE_LOCATION_CONVERTER:
57
-				return $locationInfo->getFileName();
58
-			default: 
59
-				return '';
60
-		}
61
-	}
43
+    /**
44
+     * @param LoggerLoggingEvent $event
45
+     * @return string
46
+     */
47
+    public function convert($event) {
48
+        $locationInfo = $event->getLocationInformation();
49
+        switch($this->type) {
50
+            case LoggerPatternParser::FULL_LOCATION_CONVERTER:
51
+                return $locationInfo->getFullInfo();
52
+            case LoggerPatternParser::METHOD_LOCATION_CONVERTER:
53
+                return $locationInfo->getMethodName();
54
+            case LoggerPatternParser::LINE_LOCATION_CONVERTER:
55
+                return $locationInfo->getLineNumber();
56
+            case LoggerPatternParser::FILE_LOCATION_CONVERTER:
57
+                return $locationInfo->getFileName();
58
+            default: 
59
+                return '';
60
+        }
61
+    }
62 62
 }
63 63
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/helpers/LoggerLiteralPatternConverter.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@
 block discarded – undo
24 24
  */
25 25
 class LoggerLiteralPatternConverter extends LoggerPatternConverter {
26 26
 	
27
-	/**
28
-	 * @var string
29
-	 */
30
-	private $literal;
27
+    /**
28
+     * @var string
29
+     */
30
+    private $literal;
31 31
 
32
-	/**
33
-	 * Constructor
34
-	 *
35
-	 * @param string $value
36
-	 */
37
-	public function __construct($value) {
38
-		$this->literal = $value;
39
-	}
32
+    /**
33
+     * Constructor
34
+     *
35
+     * @param string $value
36
+     */
37
+    public function __construct($value) {
38
+        $this->literal = $value;
39
+    }
40 40
 
41
-	/**
42
-	 * @param string &$sbuf
43
-	 * @param LoggerLoggingEvent $event
44
-	 */
45
-	public function format(&$sbuf, $event) {
46
-		$sbuf .= $this->literal;
47
-	}
41
+    /**
42
+     * @param string &$sbuf
43
+     * @param LoggerLoggingEvent $event
44
+     */
45
+    public function format(&$sbuf, $event) {
46
+        $sbuf .= $this->literal;
47
+    }
48 48
 
49
-	/**
50
-	 * @param LoggerLoggingEvent $event
51
-	 * @return string
52
-	 */
53
-	public function convert($event) {
54
-		return $this->literal;
55
-	}
49
+    /**
50
+     * @param LoggerLoggingEvent $event
51
+     * @return string
52
+     */
53
+    public function convert($event) {
54
+        return $this->literal;
55
+    }
56 56
 }
57 57
 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerLocationInfo.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * The internal representation of caller location information.
@@ -26,85 +26,85 @@  discard block
 block discarded – undo
26 26
  * @since 0.3
27 27
  */
28 28
 class LoggerLocationInfo {
29
-	/**
30
-	 * When location information is not available the constant
31
-	 * <i>NA</i> is returned. Current value of this string
32
-	 * constant is <b>?</b>.  
33
-	 */
34
-	const LOCATION_INFO_NA = 'NA';
29
+    /**
30
+     * When location information is not available the constant
31
+     * <i>NA</i> is returned. Current value of this string
32
+     * constant is <b>?</b>.  
33
+     */
34
+    const LOCATION_INFO_NA = 'NA';
35 35
 	
36
-	/**
37
-	* @var string Caller's line number.
38
-	*/
39
-	protected $lineNumber = null;
36
+    /**
37
+     * @var string Caller's line number.
38
+     */
39
+    protected $lineNumber = null;
40 40
 	
41
-	/**
42
-	* @var string Caller's file name.
43
-	*/
44
-	protected $fileName = null;
41
+    /**
42
+     * @var string Caller's file name.
43
+     */
44
+    protected $fileName = null;
45 45
 	
46
-	/**
47
-	* @var string Caller's fully qualified class name.
48
-	*/
49
-	protected $className = null;
46
+    /**
47
+     * @var string Caller's fully qualified class name.
48
+     */
49
+    protected $className = null;
50 50
 	
51
-	/**
52
-	* @var string Caller's method name.
53
-	*/
54
-	protected $methodName = null;
51
+    /**
52
+     * @var string Caller's method name.
53
+     */
54
+    protected $methodName = null;
55 55
 	
56
-	/**
57
-	* @var string 
58
-	*/
59
-	protected $fullInfo = null;
56
+    /**
57
+     * @var string 
58
+     */
59
+    protected $fullInfo = null;
60 60
 
61
-	/**
62
-	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
-	 *
64
-	 * @param array $trace
65
-	 * @param mixed $caller
66
-	 */
67
-	public function __construct($trace, $fqcn = null) {
68
-		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
-		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
-		$this->className = isset($trace['class']) ? $trace['class'] : null;
71
-		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
-		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
-			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
-	}
61
+    /**
62
+     * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
+     *
64
+     * @param array $trace
65
+     * @param mixed $caller
66
+     */
67
+    public function __construct($trace, $fqcn = null) {
68
+        $this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
+        $this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
+        $this->className = isset($trace['class']) ? $trace['class'] : null;
71
+        $this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
+        $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
+            '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
+    }
75 75
 
76
-	public function getClassName() {
77
-		return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
-	}
76
+    public function getClassName() {
77
+        return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
+    }
79 79
 
80
-	/**
81
-	 *	Return the file name of the caller.
82
-	 *	<p>This information is not always available.
83
-	 */
84
-	public function getFileName() {
85
-		return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
-	}
80
+    /**
81
+     *	Return the file name of the caller.
82
+     *	<p>This information is not always available.
83
+     */
84
+    public function getFileName() {
85
+        return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
+    }
87 87
 
88
-	/**
89
-	 *	Returns the line number of the caller.
90
-	 *	<p>This information is not always available.
91
-	 */
92
-	public function getLineNumber() {
93
-		return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
-	}
88
+    /**
89
+     *	Returns the line number of the caller.
90
+     *	<p>This information is not always available.
91
+     */
92
+    public function getLineNumber() {
93
+        return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
+    }
95 95
 
96
-	/**
97
-	 *	Returns the method name of the caller.
98
-	 */
99
-	public function getMethodName() {
100
-		return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
-	}
96
+    /**
97
+     *	Returns the method name of the caller.
98
+     */
99
+    public function getMethodName() {
100
+        return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
+    }
102 102
 
103
-	/**
104
-	 *	Returns the full information of the caller.
105
-	 */
106
-	public function getFullInfo() {
107
-		return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
-	}
103
+    /**
104
+     *	Returns the full information of the caller.
105
+     */
106
+    public function getFullInfo() {
107
+        return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
+    }
109 109
 
110 110
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/filters/LoggerFilterLevelRange.php 1 patch
Indentation   +87 added lines, -87 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
  * This is a very simple filter based on level matching, which can be
@@ -64,83 +64,83 @@  discard block
 block discarded – undo
64 64
  */
65 65
 class LoggerFilterLevelRange extends LoggerFilter {
66 66
 
67
-	/**
68
-	 * @var boolean
69
-	 */
70
-	private $acceptOnMatch = true;
67
+    /**
68
+     * @var boolean
69
+     */
70
+    private $acceptOnMatch = true;
71 71
 
72
-	/**
73
-	 * @var LoggerLevel
74
-	 */
75
-	private $levelMin;
72
+    /**
73
+     * @var LoggerLevel
74
+     */
75
+    private $levelMin;
76 76
   
77
-	/**
78
-	 * @var LoggerLevel
79
-	 */
80
-	private $levelMax;
77
+    /**
78
+     * @var LoggerLevel
79
+     */
80
+    private $levelMax;
81 81
 
82
-	/**
83
-	 * @param boolean $acceptOnMatch
84
-	 */
85
-	public function setAcceptOnMatch($acceptOnMatch) {
86
-		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
87
-	}
82
+    /**
83
+     * @param boolean $acceptOnMatch
84
+     */
85
+    public function setAcceptOnMatch($acceptOnMatch) {
86
+        $this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
87
+    }
88 88
 	
89
-	/**
90
-	 * @param string $l the level min to match
91
-	 */
92
-	public function setLevelMin($l) {
93
-		if($l instanceof LoggerLevel) {
94
-		    $this->levelMin = $l;
95
-		} else {
96
-			$this->levelMin = LoggerOptionConverter::toLevel($l, null);
97
-		}
98
-	}
89
+    /**
90
+     * @param string $l the level min to match
91
+     */
92
+    public function setLevelMin($l) {
93
+        if($l instanceof LoggerLevel) {
94
+            $this->levelMin = $l;
95
+        } else {
96
+            $this->levelMin = LoggerOptionConverter::toLevel($l, null);
97
+        }
98
+    }
99 99
 
100
-	/**
101
-	 * @param string $l the level max to match
102
-	 */
103
-	public function setLevelMax($l) {
104
-		if($l instanceof LoggerLevel) {
105
-		    $this->levelMax = $l;
106
-		} else {
107
-			$this->levelMax = LoggerOptionConverter::toLevel($l, null);
108
-		}
109
-	}
100
+    /**
101
+     * @param string $l the level max to match
102
+     */
103
+    public function setLevelMax($l) {
104
+        if($l instanceof LoggerLevel) {
105
+            $this->levelMax = $l;
106
+        } else {
107
+            $this->levelMax = LoggerOptionConverter::toLevel($l, null);
108
+        }
109
+    }
110 110
 
111
-	/**
112
-	 * Return the decision of this filter.
113
-	 *
114
-	 * @param LoggerLoggingEvent $event
115
-	 * @return integer
116
-	 */
117
-	public function decide(LoggerLoggingEvent $event) {
118
-		$level = $event->getLevel();
111
+    /**
112
+     * Return the decision of this filter.
113
+     *
114
+     * @param LoggerLoggingEvent $event
115
+     * @return integer
116
+     */
117
+    public function decide(LoggerLoggingEvent $event) {
118
+        $level = $event->getLevel();
119 119
 		
120
-		if($this->levelMin !== null) {
121
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
122
-				// level of event is less than minimum
123
-				return LoggerFilter::DENY;
124
-			}
125
-		}
120
+        if($this->levelMin !== null) {
121
+            if($level->isGreaterOrEqual($this->levelMin) == false) {
122
+                // level of event is less than minimum
123
+                return LoggerFilter::DENY;
124
+            }
125
+        }
126 126
 
127
-		if($this->levelMax !== null) {
128
-			if($level->toInt() > $this->levelMax->toInt()) {
129
-				// level of event is greater than maximum
130
-				// Alas, there is no Level.isGreater method. and using
131
-				// a combo of isGreaterOrEqual && !Equal seems worse than
132
-				// checking the int values of the level objects..
133
-				return LoggerFilter::DENY;
134
-			}
135
-		}
127
+        if($this->levelMax !== null) {
128
+            if($level->toInt() > $this->levelMax->toInt()) {
129
+                // level of event is greater than maximum
130
+                // Alas, there is no Level.isGreater method. and using
131
+                // a combo of isGreaterOrEqual && !Equal seems worse than
132
+                // checking the int values of the level objects..
133
+                return LoggerFilter::DENY;
134
+            }
135
+        }
136 136
 
137
-		if($this->acceptOnMatch) {
138
-			// this filter set up to bypass later filters and always return
139
-			// accept if level in range
140
-			return LoggerFilter::ACCEPT;
141
-		} else {
142
-			// event is ok for this filter; allow later filters to have a look..
143
-			return LoggerFilter::NEUTRAL;
144
-		}
145
-	}
137
+        if($this->acceptOnMatch) {
138
+            // this filter set up to bypass later filters and always return
139
+            // accept if level in range
140
+            return LoggerFilter::ACCEPT;
141
+        } else {
142
+            // event is ok for this filter; allow later filters to have a look..
143
+            return LoggerFilter::NEUTRAL;
144
+        }
145
+    }
146 146
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/filters/LoggerFilterLevelMatch.php 1 patch
Indentation   +66 added lines, -66 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
  * This is a very simple filter based on level matching.
@@ -47,58 +47,58 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class LoggerFilterLevelMatch extends LoggerFilter {
49 49
   
50
-	/** 
51
-	 * Indicates if this event should be accepted or denied on match
52
-	 * @var boolean
53
-	 */
54
-	private $acceptOnMatch = true;
50
+    /** 
51
+     * Indicates if this event should be accepted or denied on match
52
+     * @var boolean
53
+     */
54
+    private $acceptOnMatch = true;
55 55
 
56
-	/**
57
-	 * The level, when to match
58
-	 * @var LoggerLevel
59
-	 */
60
-	private $levelToMatch;
56
+    /**
57
+     * The level, when to match
58
+     * @var LoggerLevel
59
+     */
60
+    private $levelToMatch;
61 61
   
62
-	/**
63
-	 * @param boolean $acceptOnMatch
64
-	 */
65
-	public function setAcceptOnMatch($acceptOnMatch) {
66
-		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
67
-	}
62
+    /**
63
+     * @param boolean $acceptOnMatch
64
+     */
65
+    public function setAcceptOnMatch($acceptOnMatch) {
66
+        $this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
67
+    }
68 68
 	
69
-	/**
70
-	 * @param string $l the level to match
71
-	 */
72
-	public function setLevelToMatch($l) {
73
-		if($l instanceof LoggerLevel) {
74
-		    $this->levelToMatch = $l;
75
-		} else {
76
-			$this->levelToMatch = LoggerOptionConverter::toLevel($l, null);
77
-		}
78
-	}
69
+    /**
70
+     * @param string $l the level to match
71
+     */
72
+    public function setLevelToMatch($l) {
73
+        if($l instanceof LoggerLevel) {
74
+            $this->levelToMatch = $l;
75
+        } else {
76
+            $this->levelToMatch = LoggerOptionConverter::toLevel($l, null);
77
+        }
78
+    }
79 79
 
80
-	/**
81
-	 * Return the decision of this filter.
82
-	 * 
83
-	 * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
84
-	 * option is not set or if there is not match.	Otherwise, if there is a
85
-	 * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
86
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
87
-	 * returned decision is {@link LoggerFilter::DENY} if the
88
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
89
-	 *
90
-	 * @param LoggerLoggingEvent $event
91
-	 * @return integer
92
-	 */
93
-	public function decide(LoggerLoggingEvent $event) {
94
-		if($this->levelToMatch === null) {
95
-			return LoggerFilter::NEUTRAL;
96
-		}
80
+    /**
81
+     * Return the decision of this filter.
82
+     * 
83
+     * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
84
+     * option is not set or if there is not match.	Otherwise, if there is a
85
+     * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
86
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
87
+     * returned decision is {@link LoggerFilter::DENY} if the
88
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
89
+     *
90
+     * @param LoggerLoggingEvent $event
91
+     * @return integer
92
+     */
93
+    public function decide(LoggerLoggingEvent $event) {
94
+        if($this->levelToMatch === null) {
95
+            return LoggerFilter::NEUTRAL;
96
+        }
97 97
 		
98
-		if($this->levelToMatch->equals($event->getLevel())) {	
99
-			return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
100
-		} else {
101
-			return LoggerFilter::NEUTRAL;
102
-		}
103
-	}
98
+        if($this->levelToMatch->equals($event->getLevel())) {	
99
+            return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
100
+        } else {
101
+            return LoggerFilter::NEUTRAL;
102
+        }
103
+    }
104 104
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/configurators/LoggerConfiguratorPhp.php 1 patch
Indentation   +89 added lines, -89 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
  * LoggerConfiguratorPhp class
@@ -38,97 +38,97 @@  discard block
 block discarded – undo
38 38
  */
39 39
 class LoggerConfiguratorPhp implements LoggerConfigurator {
40 40
 	
41
-	public function configure(LoggerHierarchy $hierarchy, $url = '') {
42
-		return $this->doConfigure($url, $hierarchy);
43
-	}
41
+    public function configure(LoggerHierarchy $hierarchy, $url = '') {
42
+        return $this->doConfigure($url, $hierarchy);
43
+    }
44 44
 	
45
-	private function doConfigure($url, LoggerHierarchy $hierarchy) {
45
+    private function doConfigure($url, LoggerHierarchy $hierarchy) {
46 46
 		
47
-		$config = require $url;
47
+        $config = require $url;
48 48
 		
49
-		// set threshold
50
-		if(isset($config['threshold'])) {
51
-			$hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
52
-		}
49
+        // set threshold
50
+        if(isset($config['threshold'])) {
51
+            $hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
52
+        }
53 53
 		
54
-		// parse and create appenders
55
-		if(isset($config['appenders'])) {
54
+        // parse and create appenders
55
+        if(isset($config['appenders'])) {
56 56
 			
57
-			foreach($config['appenders'] as $appenderName => $appenderProperties) {
57
+            foreach($config['appenders'] as $appenderName => $appenderProperties) {
58 58
 				
59
-				$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
59
+                $appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
60 60
 				
61
-				if($appender->requiresLayout()) {
61
+                if($appender->requiresLayout()) {
62 62
 					
63
-					if(isset($appenderProperties['layout'])) {
63
+                    if(isset($appenderProperties['layout'])) {
64 64
 						
65
-						if(isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
66
-							$layoutClass = $appenderProperties['layout']['class'];							
67
-						} else {
68
-							$layoutClass = 'LoggerLayoutSimple';
69
-						}
65
+                        if(isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
66
+                            $layoutClass = $appenderProperties['layout']['class'];							
67
+                        } else {
68
+                            $layoutClass = 'LoggerLayoutSimple';
69
+                        }
70 70
 						
71
-						$layout = LoggerReflectionUtils::createObject($layoutClass);
72
-						if($layout === null) {
73
-							$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
74
-						}
71
+                        $layout = LoggerReflectionUtils::createObject($layoutClass);
72
+                        if($layout === null) {
73
+                            $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
74
+                        }
75 75
 						
76
-						if($layout instanceof LoggerLayoutPattern) {
77
-							$layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
78
-						}
76
+                        if($layout instanceof LoggerLayoutPattern) {
77
+                            $layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
78
+                        }
79 79
 						
80
-						$appender->setLayout($layout);
80
+                        $appender->setLayout($layout);
81 81
 						
82
-					} else {
83
-						// TODO: throw exception?
84
-					}
82
+                    } else {
83
+                        // TODO: throw exception?
84
+                    }
85 85
 					
86
-				}
86
+                }
87 87
 				
88
-			}
88
+            }
89 89
 			
90
-		}
90
+        }
91 91
 		
92
-		// parse and create root logger
93
-		if(isset($config['rootLogger'])) {
94
-			$rootLogger = $hierarchy->getRootLogger();
95
-			if(isset($config['rootLogger']['level'])) {
96
-				$rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug()));
97
-				if(isset($config['rootLogger']['appenders'])) {
98
-					foreach($config['rootLogger']['appenders'] as $appenderName) {
99
-						$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
100
-						if($appender !== null) {
101
-							$rootLogger->addAppender($appender);
102
-						}
103
-					}
104
-				}	
105
-			}
106
-		}
92
+        // parse and create root logger
93
+        if(isset($config['rootLogger'])) {
94
+            $rootLogger = $hierarchy->getRootLogger();
95
+            if(isset($config['rootLogger']['level'])) {
96
+                $rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug()));
97
+                if(isset($config['rootLogger']['appenders'])) {
98
+                    foreach($config['rootLogger']['appenders'] as $appenderName) {
99
+                        $appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
100
+                        if($appender !== null) {
101
+                            $rootLogger->addAppender($appender);
102
+                        }
103
+                    }
104
+                }	
105
+            }
106
+        }
107 107
 		
108
-		// parse and create loggers
109
-		if(isset($config['loggers'])) {
110
-			foreach($config['loggers'] as $loggerName => $loggerProperties) {
111
-				if(is_string($loggerName)) {
112
-					$logger = $hierarchy->getLogger($loggerName);
108
+        // parse and create loggers
109
+        if(isset($config['loggers'])) {
110
+            foreach($config['loggers'] as $loggerName => $loggerProperties) {
111
+                if(is_string($loggerName)) {
112
+                    $logger = $hierarchy->getLogger($loggerName);
113 113
 					
114
-					if(isset($loggerProperties['level'])) {
115
-						$logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug()));
116
-						if(isset($loggerProperties['appenders'])) {
117
-							foreach($loggerProperties['appenders'] as $appenderName) {
118
-								$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
119
-								if($appender !== null) {
120
-									$logger->addAppender($appender);
121
-								}
122
-							}
123
-						}	
124
-					}
125
-				} else {
126
-					// TODO: throw exception
127
-				}
128
-			}
129
-		}
114
+                    if(isset($loggerProperties['level'])) {
115
+                        $logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug()));
116
+                        if(isset($loggerProperties['appenders'])) {
117
+                            foreach($loggerProperties['appenders'] as $appenderName) {
118
+                                $appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
119
+                                if($appender !== null) {
120
+                                    $logger->addAppender($appender);
121
+                                }
122
+                            }
123
+                        }	
124
+                    }
125
+                } else {
126
+                    // TODO: throw exception
127
+                }
128
+            }
129
+        }
130 130
 		
131
-		return true;
132
-	}
131
+        return true;
132
+    }
133 133
 	
134 134
 }
Please login to merge, or discard this patch.