Completed
Push — master ( a010d0...acbc61 )
by Florian
04:56
created
lib/Payone/Log4php/LoggerFilterLevelRange.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -87,14 +87,12 @@
 block discarded – undo
87 87
 	}
88 88
 	
89 89
 	/**
90
-	 * @param string $l the level min to match
91 90
 	 */
92 91
 	public function setLevelMin($level) {
93 92
 		$this->setLevel('levelMin', $level);
94 93
 	}
95 94
 
96 95
 	/**
97
-	 * @param string $l the level max to match
98 96
 	 */
99 97
 	public function setLevelMax($level) {
100 98
 		$this->setLevel('levelMax', $level);
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -64,75 +64,75 @@
 block discarded – undo
64 64
  */
65 65
 class Payone_Log4php_LoggerFilterLevelRange extends Payone_Log4php_LoggerFilter {
66 66
 
67
-	/**
68
-	 * @var boolean
69
-	 */
70
-	protected $acceptOnMatch = true;
67
+    /**
68
+     * @var boolean
69
+     */
70
+    protected $acceptOnMatch = true;
71 71
 
72
-	/**
73
-	 * @var Payone_Log4php_LoggerLevel
74
-	 */
75
-	protected $levelMin;
72
+    /**
73
+     * @var Payone_Log4php_LoggerLevel
74
+     */
75
+    protected $levelMin;
76 76
   
77
-	/**
78
-	 * @var Payone_Log4php_LoggerLevel
79
-	 */
80
-	protected $levelMax;
77
+    /**
78
+     * @var Payone_Log4php_LoggerLevel
79
+     */
80
+    protected $levelMax;
81 81
 
82
-	/**
83
-	 * @param boolean $acceptOnMatch
84
-	 */
85
-	public function setAcceptOnMatch($acceptOnMatch) {
86
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch); 
87
-	}
82
+    /**
83
+     * @param boolean $acceptOnMatch
84
+     */
85
+    public function setAcceptOnMatch($acceptOnMatch) {
86
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch); 
87
+    }
88 88
 	
89
-	/**
90
-	 * @param string $l the level min to match
91
-	 */
92
-	public function setLevelMin($level) {
93
-		$this->setLevel('levelMin', $level);
94
-	}
89
+    /**
90
+     * @param string $l the level min to match
91
+     */
92
+    public function setLevelMin($level) {
93
+        $this->setLevel('levelMin', $level);
94
+    }
95 95
 
96
-	/**
97
-	 * @param string $l the level max to match
98
-	 */
99
-	public function setLevelMax($level) {
100
-		$this->setLevel('levelMax', $level);
101
-	}
96
+    /**
97
+     * @param string $l the level max to match
98
+     */
99
+    public function setLevelMax($level) {
100
+        $this->setLevel('levelMax', $level);
101
+    }
102 102
 
103
-	/**
104
-	 * Return the decision of this filter.
105
-	 *
106
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
107
-	 * @return integer
108
-	 */
109
-	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110
-		$level = $event->getLevel();
103
+    /**
104
+     * Return the decision of this filter.
105
+     *
106
+     * @param Payone_Log4php_LoggerLoggingEvent $event
107
+     * @return integer
108
+     */
109
+    public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110
+        $level = $event->getLevel();
111 111
 		
112
-		if($this->levelMin !== null) {
113
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
114
-				// level of event is less than minimum
115
-				return Payone_Log4php_LoggerFilter::DENY;
116
-			}
117
-		}
112
+        if($this->levelMin !== null) {
113
+            if($level->isGreaterOrEqual($this->levelMin) == false) {
114
+                // level of event is less than minimum
115
+                return Payone_Log4php_LoggerFilter::DENY;
116
+            }
117
+        }
118 118
 
119
-		if($this->levelMax !== null) {
120
-			if($level->toInt() > $this->levelMax->toInt()) {
121
-				// level of event is greater than maximum
122
-				// Alas, there is no Level.isGreater method. and using
123
-				// a combo of isGreaterOrEqual && !Equal seems worse than
124
-				// checking the int values of the level objects..
125
-				return Payone_Log4php_LoggerFilter::DENY;
126
-			}
127
-		}
119
+        if($this->levelMax !== null) {
120
+            if($level->toInt() > $this->levelMax->toInt()) {
121
+                // level of event is greater than maximum
122
+                // Alas, there is no Level.isGreater method. and using
123
+                // a combo of isGreaterOrEqual && !Equal seems worse than
124
+                // checking the int values of the level objects..
125
+                return Payone_Log4php_LoggerFilter::DENY;
126
+            }
127
+        }
128 128
 
129
-		if($this->acceptOnMatch) {
130
-			// this filter set up to bypass later filters and always return
131
-			// accept if level in range
132
-			return Payone_Log4php_LoggerFilter::ACCEPT;
133
-		} else {
134
-			// event is ok for this filter; allow later filters to have a look..
135
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
136
-		}
137
-	}
129
+        if($this->acceptOnMatch) {
130
+            // this filter set up to bypass later filters and always return
131
+            // accept if level in range
132
+            return Payone_Log4php_LoggerFilter::ACCEPT;
133
+        } else {
134
+            // event is ok for this filter; allow later filters to have a look..
135
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
136
+        }
137
+    }
138 138
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110 110
 		$level = $event->getLevel();
111 111
 		
112
-		if($this->levelMin !== null) {
113
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
112
+		if ($this->levelMin !== null) {
113
+			if ($level->isGreaterOrEqual($this->levelMin) == false) {
114 114
 				// level of event is less than minimum
115 115
 				return Payone_Log4php_LoggerFilter::DENY;
116 116
 			}
117 117
 		}
118 118
 
119
-		if($this->levelMax !== null) {
120
-			if($level->toInt() > $this->levelMax->toInt()) {
119
+		if ($this->levelMax !== null) {
120
+			if ($level->toInt() > $this->levelMax->toInt()) {
121 121
 				// level of event is greater than maximum
122 122
 				// Alas, there is no Level.isGreater method. and using
123 123
 				// a combo of isGreaterOrEqual && !Equal seems worse than
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 		}
128 128
 
129
-		if($this->acceptOnMatch) {
129
+		if ($this->acceptOnMatch) {
130 130
 			// this filter set up to bypass later filters and always return
131 131
 			// accept if level in range
132 132
 			return Payone_Log4php_LoggerFilter::ACCEPT;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerFilterStringMatch.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,6 @@
 block discarded – undo
65 65
 	}
66 66
 	
67 67
 	/**
68
-	 * @param string $s the string to match
69 68
 	 */
70 69
 	public function setStringToMatch($string) {
71 70
 		$this->setString('stringToMatch', $string);
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -47,43 +47,43 @@
 block discarded – undo
47 47
  */
48 48
 class Payone_Log4php_LoggerFilterStringMatch extends Payone_Log4php_LoggerFilter {
49 49
 
50
-	/**
51
-	 * @var boolean
52
-	 */
53
-	protected $acceptOnMatch = true;
50
+    /**
51
+     * @var boolean
52
+     */
53
+    protected $acceptOnMatch = true;
54 54
 
55
-	/**
56
-	 * @var string
57
-	 */
58
-	protected $stringToMatch;
55
+    /**
56
+     * @var string
57
+     */
58
+    protected $stringToMatch;
59 59
 
60
-	/**
61
-	 * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
62
-	 */
63
-	public function setAcceptOnMatch($acceptOnMatch) {
64
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
65
-	}
60
+    /**
61
+     * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
62
+     */
63
+    public function setAcceptOnMatch($acceptOnMatch) {
64
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
65
+    }
66 66
 	
67
-	/**
68
-	 * @param string $s the string to match
69
-	 */
70
-	public function setStringToMatch($string) {
71
-		$this->setString('stringToMatch', $string);
72
-	}
67
+    /**
68
+     * @param string $s the string to match
69
+     */
70
+    public function setStringToMatch($string) {
71
+        $this->setString('stringToMatch', $string);
72
+    }
73 73
 
74
-	/**
75
-	 * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
76
-	 */
77
-	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78
-		$msg = $event->getRenderedMessage();
74
+    /**
75
+     * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
76
+     */
77
+    public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78
+        $msg = $event->getRenderedMessage();
79 79
 		
80
-		if($msg === null or $this->stringToMatch === null) {
81
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
82
-		}
80
+        if($msg === null or $this->stringToMatch === null) {
81
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
82
+        }
83 83
 		
84
-		if(strpos($msg, $this->stringToMatch) !== false ) {
85
-			return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86
-		}
87
-		return Payone_Log4php_LoggerFilter::NEUTRAL;
88
-	}
84
+        if(strpos($msg, $this->stringToMatch) !== false ) {
85
+            return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86
+        }
87
+        return Payone_Log4php_LoggerFilter::NEUTRAL;
88
+    }
89 89
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,11 +77,11 @@
 block discarded – undo
77 77
 	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78 78
 		$msg = $event->getRenderedMessage();
79 79
 		
80
-		if($msg === null or $this->stringToMatch === null) {
80
+		if ($msg === null or $this->stringToMatch === null) {
81 81
 			return Payone_Log4php_LoggerFilter::NEUTRAL;
82 82
 		}
83 83
 		
84
-		if(strpos($msg, $this->stringToMatch) !== false ) {
84
+		if (strpos($msg, $this->stringToMatch) !== false) {
85 85
 			return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86 86
 		}
87 87
 		return Payone_Log4php_LoggerFilter::NEUTRAL;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerHierarchy.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -213,7 +213,6 @@
 block discarded – undo
213 213
 	
214 214
 	/**
215 215
 	 * Sets the main threshold level.
216
-	 * @param Payone_Log4php_LoggerLevel $l
217 216
 	 */
218 217
 	public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219 218
 		$this->threshold = $threshold;
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -49,192 +49,192 @@
 block discarded – undo
49 49
  */
50 50
 class Payone_Log4php_LoggerHierarchy {
51 51
 	
52
-	/** Array holding all Logger instances. */
53
-	protected $loggers = array();
52
+    /** Array holding all Logger instances. */
53
+    protected $loggers = array();
54 54
 	
55
-	/** 
56
-	 * The root logger.
57
-	 * @var RootLogger 
58
-	 */
59
-	protected $root = null;
55
+    /** 
56
+     * The root logger.
57
+     * @var RootLogger 
58
+     */
59
+    protected $root = null;
60 60
 	
61
-	/** 
62
-	 * The logger renderer map.
63
-	 * @var Payone_Log4php_LoggerRendererMap
64
-	 */
65
-	protected $rendererMap;
61
+    /** 
62
+     * The logger renderer map.
63
+     * @var Payone_Log4php_LoggerRendererMap
64
+     */
65
+    protected $rendererMap;
66 66
 
67
-	/** 
68
-	 * Main level threshold. Events with lower level will not be logged by any 
69
-	 * logger, regardless of it's configuration.
70
-	 * @var Payone_Log4php_LoggerLevel
71
-	 */
72
-	protected $threshold;
67
+    /** 
68
+     * Main level threshold. Events with lower level will not be logged by any 
69
+     * logger, regardless of it's configuration.
70
+     * @var Payone_Log4php_LoggerLevel
71
+     */
72
+    protected $threshold;
73 73
 	
74
-	/**
75
-	 * Creates a new logger hierarchy.
76
-	 * @param Payone_Log4php_LoggerRoot $root The root logger.
77
-	 */
78
-	public function __construct(Payone_Log4php_LoggerRoot $root) {
79
-		$this->root = $root;
80
-		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
81
-		$this->rendererMap = new Payone_Log4php_LoggerRendererMap();
82
-	}
74
+    /**
75
+     * Creates a new logger hierarchy.
76
+     * @param Payone_Log4php_LoggerRoot $root The root logger.
77
+     */
78
+    public function __construct(Payone_Log4php_LoggerRoot $root) {
79
+        $this->root = $root;
80
+        $this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
81
+        $this->rendererMap = new Payone_Log4php_LoggerRendererMap();
82
+    }
83 83
 	 
84
-	/**
85
-	 * Clears all loggers.
86
-	 */
87
-	public function clear() {
88
-		$this->loggers = array();
89
-	}
84
+    /**
85
+     * Clears all loggers.
86
+     */
87
+    public function clear() {
88
+        $this->loggers = array();
89
+    }
90 90
 	
91
-	/**
92
-	 * Check if the named logger exists in the hierarchy.
93
-	 * @param string $name
94
-	 * @return boolean
95
-	 */
96
-	public function exists($name) {
97
-		return isset($this->loggers[$name]);
98
-	}
91
+    /**
92
+     * Check if the named logger exists in the hierarchy.
93
+     * @param string $name
94
+     * @return boolean
95
+     */
96
+    public function exists($name) {
97
+        return isset($this->loggers[$name]);
98
+    }
99 99
 
100
-	/**
101
-	 * Returns all the currently defined loggers in this hierarchy as an array.
102
-	 * @return array
103
-	 */	 
104
-	public function getCurrentLoggers() {
105
-		return array_values($this->loggers);
106
-	}
100
+    /**
101
+     * Returns all the currently defined loggers in this hierarchy as an array.
102
+     * @return array
103
+     */	 
104
+    public function getCurrentLoggers() {
105
+        return array_values($this->loggers);
106
+    }
107 107
 	
108
-	/**
109
-	 * Returns a named logger instance logger. If it doesn't exist, one is created.
110
-	 * 
111
-	 * @param string $name Logger name
112
-	 * @return Logger Logger instance.
113
-	 */
114
-	public function getLogger($name) {
115
-		if(!isset($this->loggers[$name])) {
116
-			$logger = new Payone_Log4php_Logger($name);
108
+    /**
109
+     * Returns a named logger instance logger. If it doesn't exist, one is created.
110
+     * 
111
+     * @param string $name Logger name
112
+     * @return Logger Logger instance.
113
+     */
114
+    public function getLogger($name) {
115
+        if(!isset($this->loggers[$name])) {
116
+            $logger = new Payone_Log4php_Logger($name);
117 117
 
118
-			$nodes = explode('.', $name);
119
-			$firstNode = array_shift($nodes);
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->loggers[$firstNode])) {
123
-				$logger->setParent($this->loggers[$firstNode]);
124
-			} else {
125
-				// if there is no father, set root logger as father
126
-				$logger->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->loggers[$firstNode])) {
123
+                $logger->setParent($this->loggers[$firstNode]);
124
+            } else {
125
+                // if there is no father, set root logger as father
126
+                $logger->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->loggers[$parentNode]) and $parentNode != $name) {
135
-						$logger->setParent($this->loggers[$parentNode]);
136
-					}
137
-					$firstNode .= ".$node";
138
-				}
139
-			}
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->loggers[$parentNode]) and $parentNode != $name) {
135
+                        $logger->setParent($this->loggers[$parentNode]);
136
+                    }
137
+                    $firstNode .= ".$node";
138
+                }
139
+            }
140 140
 			
141
-			$this->loggers[$name] = $logger;
142
-		}		
141
+            $this->loggers[$name] = $logger;
142
+        }		
143 143
 		
144
-		return $this->loggers[$name];
145
-	} 
144
+        return $this->loggers[$name];
145
+    } 
146 146
 	
147
-	/**
148
-	 * Returns the logger renderer map.
149
-	 * @return Payone_Log4php_LoggerRendererMap
150
-	 */
151
-	public function getRendererMap() {
152
-		return $this->rendererMap;
153
-	}
147
+    /**
148
+     * Returns the logger renderer map.
149
+     * @return Payone_Log4php_LoggerRendererMap
150
+     */
151
+    public function getRendererMap() {
152
+        return $this->rendererMap;
153
+    }
154 154
 	
155
-	/**
156
-	 * Returns the root logger.
157
-	 * @return Payone_Log4php_LoggerRoot
158
-	 */ 
159
-	public function getRootLogger() {
160
-		if(!isset($this->root) or $this->root == null) {
161
-			$this->root = new Payone_Log4php_LoggerRoot();
162
-		}
163
-		return $this->root;
164
-	}
155
+    /**
156
+     * Returns the root logger.
157
+     * @return Payone_Log4php_LoggerRoot
158
+     */ 
159
+    public function getRootLogger() {
160
+        if(!isset($this->root) or $this->root == null) {
161
+            $this->root = new Payone_Log4php_LoggerRoot();
162
+        }
163
+        return $this->root;
164
+    }
165 165
 	 
166
-	/**
167
-	 * Returns the main threshold level.
168
-	 * @return Payone_Log4php_LoggerLevel
169
-	 */
170
-	public function getThreshold() {
171
-		return $this->threshold;
172
-	} 
166
+    /**
167
+     * Returns the main threshold level.
168
+     * @return Payone_Log4php_LoggerLevel
169
+     */
170
+    public function getThreshold() {
171
+        return $this->threshold;
172
+    } 
173 173
 
174
-	/**
175
-	 * Returns true if the hierarchy is disabled for given log level and false
176
-	 * otherwise.
177
-	 * @return boolean
178
-	 */
179
-	public function isDisabled(Payone_Log4php_LoggerLevel $level) {
180
-		return ($this->threshold->toInt() > $level->toInt());
181
-	}
174
+    /**
175
+     * Returns true if the hierarchy is disabled for given log level and false
176
+     * otherwise.
177
+     * @return boolean
178
+     */
179
+    public function isDisabled(Payone_Log4php_LoggerLevel $level) {
180
+        return ($this->threshold->toInt() > $level->toInt());
181
+    }
182 182
 	
183
-	/**
184
-	 * Reset all values contained in this hierarchy instance to their
185
-	 * default. 
186
-	 *
187
-	 * This removes all appenders from all loggers, sets
188
-	 * the level of all non-root loggers to <i>null</i>,
189
-	 * sets their additivity flag to <i>true</i> and sets the level
190
-	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
191
-	 * 
192
-	 * <p>Existing loggers are not removed. They are just reset.
193
-	 *
194
-	 * <p>This method should be used sparingly and with care as it will
195
-	 * block all logging until it is completed.</p>
196
-	 */
197
-	public function resetConfiguration() {
198
-		$root = $this->getRootLogger();
183
+    /**
184
+     * Reset all values contained in this hierarchy instance to their
185
+     * default. 
186
+     *
187
+     * This removes all appenders from all loggers, sets
188
+     * the level of all non-root loggers to <i>null</i>,
189
+     * sets their additivity flag to <i>true</i> and sets the level
190
+     * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
191
+     * 
192
+     * <p>Existing loggers are not removed. They are just reset.
193
+     *
194
+     * <p>This method should be used sparingly and with care as it will
195
+     * block all logging until it is completed.</p>
196
+     */
197
+    public function resetConfiguration() {
198
+        $root = $this->getRootLogger();
199 199
 		
200
-		$root->setLevel(Payone_Log4php_LoggerLevel::getLevelDebug());
201
-		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202
-		$this->shutDown();
200
+        $root->setLevel(Payone_Log4php_LoggerLevel::getLevelDebug());
201
+        $this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202
+        $this->shutDown();
203 203
 		
204
-		foreach($this->loggers as $logger) {
205
-			$logger->setLevel(null);
206
-			$logger->setAdditivity(true);
207
-			$logger->removeAllAppenders();
208
-		}
204
+        foreach($this->loggers as $logger) {
205
+            $logger->setLevel(null);
206
+            $logger->setAdditivity(true);
207
+            $logger->removeAllAppenders();
208
+        }
209 209
 		
210
-		$this->rendererMap->clear();
211
-		Payone_Log4php_LoggerAppenderPool::clear();
212
-	}
210
+        $this->rendererMap->clear();
211
+        Payone_Log4php_LoggerAppenderPool::clear();
212
+    }
213 213
 	
214
-	/**
215
-	 * Sets the main threshold level.
216
-	 * @param Payone_Log4php_LoggerLevel $l
217
-	 */
218
-	public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219
-		$this->threshold = $threshold;
220
-	}
214
+    /**
215
+     * Sets the main threshold level.
216
+     * @param Payone_Log4php_LoggerLevel $l
217
+     */
218
+    public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219
+        $this->threshold = $threshold;
220
+    }
221 221
 	
222
-	/**
223
-	 * Shutting down a hierarchy will <i>safely</i> close and remove
224
-	 * all appenders in all loggers including the root logger.
225
-	 * 
226
-	 * The shutdown method is careful to close nested
227
-	 * appenders before closing regular appenders. This is allows
228
-	 * configurations where a regular appender is attached to a logger
229
-	 * and again to a nested appender.
230
-	 * 
231
-	 * @todo Check if the last paragraph is correct.
232
-	 */
233
-	public function shutdown() {
234
-		$this->root->removeAllAppenders();
222
+    /**
223
+     * Shutting down a hierarchy will <i>safely</i> close and remove
224
+     * all appenders in all loggers including the root logger.
225
+     * 
226
+     * The shutdown method is careful to close nested
227
+     * appenders before closing regular appenders. This is allows
228
+     * configurations where a regular appender is attached to a logger
229
+     * and again to a nested appender.
230
+     * 
231
+     * @todo Check if the last paragraph is correct.
232
+     */
233
+    public function shutdown() {
234
+        $this->root->removeAllAppenders();
235 235
 		
236
-		foreach($this->loggers as $logger) {
237
-			$logger->removeAllAppenders();
238
-		}
239
-	}
236
+        foreach($this->loggers as $logger) {
237
+            $logger->removeAllAppenders();
238
+        }
239
+    }
240 240
 } 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	 * @return Logger Logger instance.
113 113
 	 */
114 114
 	public function getLogger($name) {
115
-		if(!isset($this->loggers[$name])) {
115
+		if (!isset($this->loggers[$name])) {
116 116
 			$logger = new Payone_Log4php_Logger($name);
117 117
 
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->loggers[$firstNode])) {
122
+			if ($firstNode != $name and isset($this->loggers[$firstNode])) {
123 123
 				$logger->setParent($this->loggers[$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->loggers[$parentNode]) and $parentNode != $name) {
134
+					if (isset($this->loggers[$parentNode]) and $parentNode != $name) {
135 135
 						$logger->setParent($this->loggers[$parentNode]);
136 136
 					}
137 137
 					$firstNode .= ".$node";
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Payone_Log4php_LoggerRoot
158 158
 	 */ 
159 159
 	public function getRootLogger() {
160
-		if(!isset($this->root) or $this->root == null) {
160
+		if (!isset($this->root) or $this->root == null) {
161 161
 			$this->root = new Payone_Log4php_LoggerRoot();
162 162
 		}
163 163
 		return $this->root;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202 202
 		$this->shutDown();
203 203
 		
204
-		foreach($this->loggers as $logger) {
204
+		foreach ($this->loggers as $logger) {
205 205
 			$logger->setLevel(null);
206 206
 			$logger->setAdditivity(true);
207 207
 			$logger->removeAllAppenders();
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	public function shutdown() {
234 234
 		$this->root->removeAllAppenders();
235 235
 		
236
-		foreach($this->loggers as $logger) {
236
+		foreach ($this->loggers as $logger) {
237 237
 			$logger->removeAllAppenders();
238 238
 		}
239 239
 	}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLevel.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Compares two logger levels.
75 75
 	 *
76
-	 * @param LoggerLevels $other
77
-	 * @return boolean 
76
+	 * @param Payone_Log4php_LoggerLevel $other
77
+	 * @return boolean|null 
78 78
 	 */
79 79
 	public function equals($other) {
80 80
 		if($other instanceof Payone_Log4php_LoggerLevel) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * this method returns the provided default level.
224 224
 	 *
225 225
 	 * @param mixed $arg The value to convert to level.
226
-	 * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
226
+	 * @param Payone_Log4php_LoggerLevel $defaultLevel Value to return if conversion is not possible.
227 227
 	 * @return Payone_Log4php_LoggerLevel
228 228
 	 */
229 229
 	public static function toLevel($arg, $defaultLevel = null) {
Please login to merge, or discard this patch.
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -33,224 +33,224 @@
 block discarded – undo
33 33
  */
34 34
 class Payone_Log4php_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 TRACE = 5000;
43
-	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 TRACE = 5000;
43
+    const ALL = -2147483647;
44 44
 
45
-	/** Integer level value. */
46
-	private $level;
45
+    /** Integer level value. */
46
+    private $level;
47 47
 	
48
-	/** Contains a list of instantiated levels. */
49
-	private static $levelMap;
48
+    /** Contains a list of instantiated levels. */
49
+    private static $levelMap;
50 50
 
51
-	/** String representation of the level. */
52
-	private $levelStr;
51
+    /** String representation of the level. */
52
+    private $levelStr;
53 53
 
54
-	/** 
55
-	 * Equivalent syslog level.
56
-	 * @var integer
57
-	 */
58
-	private $syslogEquivalent;
54
+    /** 
55
+     * Equivalent syslog level.
56
+     * @var integer
57
+     */
58
+    private $syslogEquivalent;
59 59
 
60
-	/**
61
-	 * Constructor
62
-	 *
63
-	 * @param integer $level
64
-	 * @param string $levelStr
65
-	 * @param integer $syslogEquivalent
66
-	 */
67
-	private function __construct($level, $levelStr, $syslogEquivalent) {
68
-		$this->level = $level;
69
-		$this->levelStr = $levelStr;
70
-		$this->syslogEquivalent = $syslogEquivalent;
71
-	}
60
+    /**
61
+     * Constructor
62
+     *
63
+     * @param integer $level
64
+     * @param string $levelStr
65
+     * @param integer $syslogEquivalent
66
+     */
67
+    private function __construct($level, $levelStr, $syslogEquivalent) {
68
+        $this->level = $level;
69
+        $this->levelStr = $levelStr;
70
+        $this->syslogEquivalent = $syslogEquivalent;
71
+    }
72 72
 
73
-	/**
74
-	 * Compares two logger levels.
75
-	 *
76
-	 * @param LoggerLevels $other
77
-	 * @return boolean 
78
-	 */
79
-	public function equals($other) {
80
-		if($other instanceof Payone_Log4php_LoggerLevel) {
81
-			if($this->level == $other->level) {
82
-				return true;
83
-			}
84
-		} else {
85
-			return false;
86
-		}
87
-	}
73
+    /**
74
+     * Compares two logger levels.
75
+     *
76
+     * @param LoggerLevels $other
77
+     * @return boolean 
78
+     */
79
+    public function equals($other) {
80
+        if($other instanceof Payone_Log4php_LoggerLevel) {
81
+            if($this->level == $other->level) {
82
+                return true;
83
+            }
84
+        } else {
85
+            return false;
86
+        }
87
+    }
88 88
 	
89
-	/**
90
-	 * Returns an Off Level
91
-	 * @return Payone_Log4php_LoggerLevel
92
-	 */
93
-	public static function getLevelOff() {
94
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95
-			self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96
-		}
97
-		return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
98
-	}
89
+    /**
90
+     * Returns an Off Level
91
+     * @return Payone_Log4php_LoggerLevel
92
+     */
93
+    public static function getLevelOff() {
94
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95
+            self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96
+        }
97
+        return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
98
+    }
99 99
 
100
-	/**
101
-	 * Returns a Fatal Level
102
-	 * @return Payone_Log4php_LoggerLevel
103
-	 */
104
-	public static function getLevelFatal() {
105
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106
-			self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107
-		}
108
-		return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
109
-	}
100
+    /**
101
+     * Returns a Fatal Level
102
+     * @return Payone_Log4php_LoggerLevel
103
+     */
104
+    public static function getLevelFatal() {
105
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106
+            self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107
+        }
108
+        return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
109
+    }
110 110
 	
111
-	/**
112
-	 * Returns an Error Level
113
-	 * @return Payone_Log4php_LoggerLevel
114
-	 */
115
-	public static function getLevelError() {
116
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117
-			self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118
-		}
119
-		return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
120
-	}
111
+    /**
112
+     * Returns an Error Level
113
+     * @return Payone_Log4php_LoggerLevel
114
+     */
115
+    public static function getLevelError() {
116
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117
+            self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118
+        }
119
+        return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
120
+    }
121 121
 	
122
-	/**
123
-	 * Returns a Warn Level
124
-	 * @return Payone_Log4php_LoggerLevel
125
-	 */
126
-	public static function getLevelWarn() {
127
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128
-			self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129
-		}
130
-		return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
131
-	}
122
+    /**
123
+     * Returns a Warn Level
124
+     * @return Payone_Log4php_LoggerLevel
125
+     */
126
+    public static function getLevelWarn() {
127
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128
+            self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129
+        }
130
+        return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
131
+    }
132 132
 
133
-	/**
134
-	 * Returns an Info Level
135
-	 * @return Payone_Log4php_LoggerLevel
136
-	 */
137
-	public static function getLevelInfo() {
138
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139
-			self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140
-		}
141
-		return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
142
-	}
133
+    /**
134
+     * Returns an Info Level
135
+     * @return Payone_Log4php_LoggerLevel
136
+     */
137
+    public static function getLevelInfo() {
138
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139
+            self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140
+        }
141
+        return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
142
+    }
143 143
 
144
-	/**
145
-	 * Returns a Debug Level
146
-	 * @return Payone_Log4php_LoggerLevel
147
-	 */
148
-	public static function getLevelDebug() {
149
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150
-			self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151
-		}
152
-		return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
153
-	}
144
+    /**
145
+     * Returns a Debug Level
146
+     * @return Payone_Log4php_LoggerLevel
147
+     */
148
+    public static function getLevelDebug() {
149
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150
+            self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151
+        }
152
+        return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
153
+    }
154 154
 	
155
-	/**
156
-	 * Returns a Trace Level
157
-	 * @return Payone_Log4php_LoggerLevel
158
-	 */
159
-	public static function getLevelTrace() {
160
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161
-			self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162
-		}
163
-		return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
164
-	}	
155
+    /**
156
+     * Returns a Trace Level
157
+     * @return Payone_Log4php_LoggerLevel
158
+     */
159
+    public static function getLevelTrace() {
160
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161
+            self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162
+        }
163
+        return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
164
+    }	
165 165
 
166
-	/**
167
-	 * Returns an All Level
168
-	 * @return Payone_Log4php_LoggerLevel
169
-	 */
170
-	public static function getLevelAll() {
171
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172
-			self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173
-		}
174
-		return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
175
-	}
166
+    /**
167
+     * Returns an All Level
168
+     * @return Payone_Log4php_LoggerLevel
169
+     */
170
+    public static function getLevelAll() {
171
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172
+            self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173
+        }
174
+        return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
175
+    }
176 176
 	
177
-	/**
178
-	 * Return the syslog equivalent of this priority as an integer.
179
-	 * @return integer
180
-	 */
181
-	public function getSyslogEquivalent() {
182
-		return $this->syslogEquivalent;
183
-	}
177
+    /**
178
+     * Return the syslog equivalent of this priority as an integer.
179
+     * @return integer
180
+     */
181
+    public function getSyslogEquivalent() {
182
+        return $this->syslogEquivalent;
183
+    }
184 184
 
185
-	/**
186
-	 * Returns <i>true</i> if this level has a higher or equal
187
-	 * level than the level passed as argument, <i>false</i>
188
-	 * otherwise.
189
-	 *
190
-	 * @param Payone_Log4php_LoggerLevel $other
191
-	 * @return boolean
192
-	 */
193
-	public function isGreaterOrEqual($other) {
194
-		return $this->level >= $other->level;
195
-	}
185
+    /**
186
+     * Returns <i>true</i> if this level has a higher or equal
187
+     * level than the level passed as argument, <i>false</i>
188
+     * otherwise.
189
+     *
190
+     * @param Payone_Log4php_LoggerLevel $other
191
+     * @return boolean
192
+     */
193
+    public function isGreaterOrEqual($other) {
194
+        return $this->level >= $other->level;
195
+    }
196 196
 
197
-	/**
198
-	 * Returns the string representation of this level.
199
-	 * @return string
200
-	 */
201
-	public function toString() {
202
-		return $this->levelStr;
203
-	}
197
+    /**
198
+     * Returns the string representation of this level.
199
+     * @return string
200
+     */
201
+    public function toString() {
202
+        return $this->levelStr;
203
+    }
204 204
 	
205
-	/**
206
-	 * Returns the string representation of this level.
207
-	 * @return string
208
-	 */
209
-	public function __toString() {
210
-		return $this->toString();
211
-	}
205
+    /**
206
+     * Returns the string representation of this level.
207
+     * @return string
208
+     */
209
+    public function __toString() {
210
+        return $this->toString();
211
+    }
212 212
 
213
-	/**
214
-	 * Returns the integer representation of this level.
215
-	 * @return integer
216
-	 */
217
-	public function toInt() {
218
-		return $this->level;
219
-	}
213
+    /**
214
+     * Returns the integer representation of this level.
215
+     * @return integer
216
+     */
217
+    public function toInt() {
218
+        return $this->level;
219
+    }
220 220
 
221
-	/**
222
-	 * Convert the input argument to a level. If the conversion fails, then 
223
-	 * this method returns the provided default level.
224
-	 *
225
-	 * @param mixed $arg The value to convert to level.
226
-	 * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
227
-	 * @return Payone_Log4php_LoggerLevel
228
-	 */
229
-	public static function toLevel($arg, $defaultLevel = null) {
230
-		if(is_int($arg)) {
231
-			switch($arg) {
232
-				case self::ALL:	return self::getLevelAll();
233
-				case self::TRACE: return self::getLevelTrace();
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 'TRACE': return self::getLevelTrace();
246
-				case 'DEBUG': return self::getLevelDebug();
247
-				case 'INFO': return self::getLevelInfo();
248
-				case 'WARN': return self::getLevelWarn();
249
-				case 'ERROR': return self::getLevelError();
250
-				case 'FATAL': return self::getLevelFatal();
251
-				case 'OFF':	return self::getLevelOff();
252
-				default: return $defaultLevel;
253
-			}
254
-		}
255
-	}
221
+    /**
222
+     * Convert the input argument to a level. If the conversion fails, then 
223
+     * this method returns the provided default level.
224
+     *
225
+     * @param mixed $arg The value to convert to level.
226
+     * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
227
+     * @return Payone_Log4php_LoggerLevel
228
+     */
229
+    public static function toLevel($arg, $defaultLevel = null) {
230
+        if(is_int($arg)) {
231
+            switch($arg) {
232
+                case self::ALL:	return self::getLevelAll();
233
+                case self::TRACE: return self::getLevelTrace();
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 'TRACE': return self::getLevelTrace();
246
+                case 'DEBUG': return self::getLevelDebug();
247
+                case 'INFO': return self::getLevelInfo();
248
+                case 'WARN': return self::getLevelWarn();
249
+                case 'ERROR': return self::getLevelError();
250
+                case 'FATAL': return self::getLevelFatal();
251
+                case 'OFF':	return self::getLevelOff();
252
+                default: return $defaultLevel;
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
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @return boolean 
78 78
 	 */
79 79
 	public function equals($other) {
80
-		if($other instanceof Payone_Log4php_LoggerLevel) {
81
-			if($this->level == $other->level) {
80
+		if ($other instanceof Payone_Log4php_LoggerLevel) {
81
+			if ($this->level == $other->level) {
82 82
 				return true;
83 83
 			}
84 84
 		} else {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return Payone_Log4php_LoggerLevel
92 92
 	 */
93 93
 	public static function getLevelOff() {
94
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
94
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95 95
 			self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96 96
 		}
97 97
 		return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return Payone_Log4php_LoggerLevel
103 103
 	 */
104 104
 	public static function getLevelFatal() {
105
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
105
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106 106
 			self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107 107
 		}
108 108
 		return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return Payone_Log4php_LoggerLevel
114 114
 	 */
115 115
 	public static function getLevelError() {
116
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
116
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117 117
 			self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118 118
 		}
119 119
 		return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return Payone_Log4php_LoggerLevel
125 125
 	 */
126 126
 	public static function getLevelWarn() {
127
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
127
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128 128
 			self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129 129
 		}
130 130
 		return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return Payone_Log4php_LoggerLevel
136 136
 	 */
137 137
 	public static function getLevelInfo() {
138
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
138
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139 139
 			self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140 140
 		}
141 141
 		return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return Payone_Log4php_LoggerLevel
147 147
 	 */
148 148
 	public static function getLevelDebug() {
149
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
149
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150 150
 			self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151 151
 		}
152 152
 		return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Payone_Log4php_LoggerLevel
158 158
 	 */
159 159
 	public static function getLevelTrace() {
160
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
160
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161 161
 			self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162 162
 		}
163 163
 		return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return Payone_Log4php_LoggerLevel
169 169
 	 */
170 170
 	public static function getLevelAll() {
171
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
171
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172 172
 			self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173 173
 		}
174 174
 		return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * @return Payone_Log4php_LoggerLevel
228 228
 	 */
229 229
 	public static function toLevel($arg, $defaultLevel = null) {
230
-		if(is_int($arg)) {
231
-			switch($arg) {
230
+		if (is_int($arg)) {
231
+			switch ($arg) {
232 232
 				case self::ALL:	return self::getLevelAll();
233 233
 				case self::TRACE: return self::getLevelTrace();
234 234
 				case self::DEBUG: return self::getLevelDebug();
@@ -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 'TRACE': return self::getLevelTrace();
246 246
 				case 'DEBUG': return self::getLevelDebug();
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLocationInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63 63
 	 *
64 64
 	 * @param array $trace
65
-	 * @param mixed $caller
65
+	 * @param string $fqcn
66 66
 	 */
67 67
 	public function __construct($trace, $fqcn = null) {
68 68
 		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -26,85 +26,85 @@
 block discarded – undo
26 26
  * @since 0.3
27 27
  */
28 28
 class Payone_Log4php_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.
lib/Payone/Log4php/LoggerLoggingEvent.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	* LoggerLoggingEvent are filled when actually needed.
120 120
 	*
121 121
 	* @param string $fqcn name of the caller class.
122
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
122
+	* @param Payone_Log4php_Logger $logger The {@link Logger} category of this event or the logger name.
123 123
 	* @param Payone_Log4php_LoggerLevel $priority The level of this event.
124 124
 	* @param mixed $message The message of this event.
125 125
 	* @param integer $timeStamp the timestamp of this logging event.
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	
315 315
 	/**
316 316
 	 * Calculates the time of this event.
317
-	 * @return the time after event starttime when this event has occured
317
+	 * @return string time after event starttime when this event has occured
318 318
 	 */
319 319
 	public function getTime() {
320 320
 		$eventTime = $this->getTimeStamp();
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	/**
336
-	 * @return mixed LoggerThrowableInformation
336
+	 * @return Payone_Log4php_LoggerThrowableInformation LoggerThrowableInformation
337 337
 	 */
338 338
 	public function getThrowableInformation() {
339 339
 		return $this->throwableInfo;
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -26,344 +26,344 @@
 block discarded – undo
26 26
  */
27 27
 class Payone_Log4php_LoggerLoggingEvent {
28 28
 
29
-	private static $startTime;
29
+    private static $startTime;
30 30
 
31
-	/** 
32
-	* @var string Fully Qualified Class Name of the calling category class.
33
-	*/
34
-	private $fqcn;
31
+    /** 
32
+     * @var string Fully Qualified Class Name of the calling category class.
33
+     */
34
+    private $fqcn;
35 35
 	
36
-	/**
37
-	* @var Logger reference
38
-	*/
39
-	private $logger = null;
36
+    /**
37
+     * @var Logger reference
38
+     */
39
+    private $logger = null;
40 40
 	
41
-	/** 
42
-	 * The category (logger) name.
43
-	 * This field will be marked as private in future
44
-	 * releases. Please do not access it directly. 
45
-	 * Use the {@link getLoggerName()} method instead.
46
-	 * @deprecated 
47
-	 */
48
-	private $categoryName;
41
+    /** 
42
+     * The category (logger) name.
43
+     * This field will be marked as private in future
44
+     * releases. Please do not access it directly. 
45
+     * Use the {@link getLoggerName()} method instead.
46
+     * @deprecated 
47
+     */
48
+    private $categoryName;
49 49
 	
50
-	/** 
51
-	 * Level of the logging event.
52
-	 * @var Payone_Log4php_LoggerLevel
53
-	 */
54
-	protected $level;
50
+    /** 
51
+     * Level of the logging event.
52
+     * @var Payone_Log4php_LoggerLevel
53
+     */
54
+    protected $level;
55 55
 	
56
-	/** 
57
-	 * The nested diagnostic context (NDC) of logging event.
58
-	 * @var string  
59
-	 */
60
-	private $ndc;
56
+    /** 
57
+     * The nested diagnostic context (NDC) of logging event.
58
+     * @var string  
59
+     */
60
+    private $ndc;
61 61
 	
62
-	/** 
63
-	 * Have we tried to do an NDC lookup? If we did, there is no need
64
-	 * to do it again.	Note that its value is always false when
65
-	 * serialized. Thus, a receiving SocketNode will never use it's own
66
-	 * (incorrect) NDC. See also writeObject method.
67
-	 * @var boolean
68
-	 */
69
-	private $ndcLookupRequired = true;
62
+    /** 
63
+     * Have we tried to do an NDC lookup? If we did, there is no need
64
+     * to do it again.	Note that its value is always false when
65
+     * serialized. Thus, a receiving SocketNode will never use it's own
66
+     * (incorrect) NDC. See also writeObject method.
67
+     * @var boolean
68
+     */
69
+    private $ndcLookupRequired = true;
70 70
 	
71
-	/** 
72
-	 * Have we tried to do an MDC lookup? If we did, there is no need
73
-	 * to do it again.	Note that its value is always false when
74
-	 * serialized. See also the getMDC and getMDCCopy methods.
75
-	 * @var boolean	 
76
-	 */
77
-	private $mdcCopyLookupRequired = true;
71
+    /** 
72
+     * Have we tried to do an MDC lookup? If we did, there is no need
73
+     * to do it again.	Note that its value is always false when
74
+     * serialized. See also the getMDC and getMDCCopy methods.
75
+     * @var boolean	 
76
+     */
77
+    private $mdcCopyLookupRequired = true;
78 78
 	
79
-	/** 
80
-	 * @var mixed The application supplied message of logging event. 
81
-	 */
82
-	private $message;
79
+    /** 
80
+     * @var mixed The application supplied message of logging event. 
81
+     */
82
+    private $message;
83 83
 	
84
-	/** 
85
-	 * The application supplied message rendered through the log4php
86
-	 * objet rendering mechanism. At present renderedMessage == message.
87
-	 * @var string
88
-	 */
89
-	private $renderedMessage = null;
84
+    /** 
85
+     * The application supplied message rendered through the log4php
86
+     * objet rendering mechanism. At present renderedMessage == message.
87
+     * @var string
88
+     */
89
+    private $renderedMessage = null;
90 90
 	
91
-	/** 
92
-	 * The name of thread in which this logging event was generated.
93
-	 * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
94
-	 * @var mixed
95
-	 */
96
-	private $threadName = null;
91
+    /** 
92
+     * The name of thread in which this logging event was generated.
93
+     * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
94
+     * @var mixed
95
+     */
96
+    private $threadName = null;
97 97
 	
98
-	/** 
99
-	* The number of seconds elapsed from 1/1/1970 until logging event
100
-	* was created plus microseconds if available.
101
-	* @var float
102
-	*/
103
-	public $timeStamp;
98
+    /** 
99
+     * The number of seconds elapsed from 1/1/1970 until logging event
100
+     * was created plus microseconds if available.
101
+     * @var float
102
+     */
103
+    public $timeStamp;
104 104
 	
105
-	/** 
106
-	* @var Payone_Log4php_LoggerLocationInfo Location information for the caller.
107
-	*/
108
-	private $locationInfo = null;
105
+    /** 
106
+     * @var Payone_Log4php_LoggerLocationInfo Location information for the caller.
107
+     */
108
+    private $locationInfo = null;
109 109
 	
110
-	/**
111
-	 * @var Payone_Log4php_LoggerThrowableInformation log4php internal representation of throwable
112
-	 */
113
-	private $throwableInfo = null;
110
+    /**
111
+     * @var Payone_Log4php_LoggerThrowableInformation log4php internal representation of throwable
112
+     */
113
+    private $throwableInfo = null;
114 114
 	
115
-	/**
116
-	* Instantiate a LoggingEvent from the supplied parameters.
117
-	*
118
-	* Except {@link $timeStamp} all the other fields of
119
-	* LoggerLoggingEvent are filled when actually needed.
120
-	*
121
-	* @param string $fqcn name of the caller class.
122
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
123
-	* @param Payone_Log4php_LoggerLevel $priority The level of this event.
124
-	* @param mixed $message The message of this event.
125
-	* @param integer $timeStamp the timestamp of this logging event.
126
-	* @param Exception $throwable The throwable associated with logging event
127
-	*/
128
-	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129
-		$this->fqcn = $fqcn;
130
-		if($logger instanceof Payone_Log4php_Logger) {
131
-			$this->logger = $logger;
132
-			$this->categoryName = $logger->getName();
133
-		} else {
134
-			$this->categoryName = strval($logger);
135
-		}
136
-		$this->level = $priority;
137
-		$this->message = $message;
138
-		if($timeStamp !== null && is_float($timeStamp)) {
139
-			$this->timeStamp = $timeStamp;
140
-		} else {
141
-			$this->timeStamp = microtime(true);
142
-		}
115
+    /**
116
+     * Instantiate a LoggingEvent from the supplied parameters.
117
+     *
118
+     * Except {@link $timeStamp} all the other fields of
119
+     * LoggerLoggingEvent are filled when actually needed.
120
+     *
121
+     * @param string $fqcn name of the caller class.
122
+     * @param mixed $logger The {@link Logger} category of this event or the logger name.
123
+     * @param Payone_Log4php_LoggerLevel $priority The level of this event.
124
+     * @param mixed $message The message of this event.
125
+     * @param integer $timeStamp the timestamp of this logging event.
126
+     * @param Exception $throwable The throwable associated with logging event
127
+     */
128
+    public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129
+        $this->fqcn = $fqcn;
130
+        if($logger instanceof Payone_Log4php_Logger) {
131
+            $this->logger = $logger;
132
+            $this->categoryName = $logger->getName();
133
+        } else {
134
+            $this->categoryName = strval($logger);
135
+        }
136
+        $this->level = $priority;
137
+        $this->message = $message;
138
+        if($timeStamp !== null && is_float($timeStamp)) {
139
+            $this->timeStamp = $timeStamp;
140
+        } else {
141
+            $this->timeStamp = microtime(true);
142
+        }
143 143
 		
144
-		if ($throwable !== null && $throwable instanceof Exception) {
145
-			$this->throwableInfo = new Payone_Log4php_LoggerThrowableInformation($throwable);
146
-		}
147
-	}
144
+        if ($throwable !== null && $throwable instanceof Exception) {
145
+            $this->throwableInfo = new Payone_Log4php_LoggerThrowableInformation($throwable);
146
+        }
147
+    }
148 148
 
149
-	/**
150
-	 * Returns the full qualified classname.
151
-	 * TODO: PHP does contain namespaces in 5.3. Those should be returned too, 
152
-	 */
153
-	 public function getFullQualifiedClassname() {
154
-		 return $this->fqcn;
155
-	 }
149
+    /**
150
+     * Returns the full qualified classname.
151
+     * TODO: PHP does contain namespaces in 5.3. Those should be returned too, 
152
+     */
153
+        public function getFullQualifiedClassname() {
154
+            return $this->fqcn;
155
+        }
156 156
 	 
157
-	/**
158
-	 * Set the location information for this logging event. The collected
159
-	 * information is cached for future use.
160
-	 *
161
-	 * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
162
-	 * to collect informations about caller.</p>
163
-	 * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
164
-	 * @return Payone_Log4php_LoggerLocationInfo
165
-	 */
166
-	public function getLocationInformation() {
167
-		if($this->locationInfo === null) {
157
+    /**
158
+     * Set the location information for this logging event. The collected
159
+     * information is cached for future use.
160
+     *
161
+     * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
162
+     * to collect informations about caller.</p>
163
+     * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
164
+     * @return Payone_Log4php_LoggerLocationInfo
165
+     */
166
+    public function getLocationInformation() {
167
+        if($this->locationInfo === null) {
168 168
 
169
-			$locationInfo = array();
170
-			$trace = debug_backtrace();
171
-			$prevHop = null;
172
-			// make a downsearch to identify the caller
173
-			$hop = array_pop($trace);
174
-			while($hop !== null) {
175
-				if(isset($hop['class'])) {
176
-					// we are sometimes in functions = no class available: avoid php warning here
177
-					$className = strtolower($hop['class']);
178
-					if(!empty($className) and ($className == 'logger' or 
179
-						strtolower(get_parent_class($className)) == 'logger')) {
180
-						$locationInfo['line'] = $hop['line'];
181
-						$locationInfo['file'] = $hop['file'];
182
-						break;
183
-					}
184
-				}
185
-				$prevHop = $hop;
186
-				$hop = array_pop($trace);
187
-			}
188
-			$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
-			if(isset($prevHop['function']) and
190
-				$prevHop['function'] !== 'include' and
191
-				$prevHop['function'] !== 'include_once' and
192
-				$prevHop['function'] !== 'require' and
193
-				$prevHop['function'] !== 'require_once') {
169
+            $locationInfo = array();
170
+            $trace = debug_backtrace();
171
+            $prevHop = null;
172
+            // make a downsearch to identify the caller
173
+            $hop = array_pop($trace);
174
+            while($hop !== null) {
175
+                if(isset($hop['class'])) {
176
+                    // we are sometimes in functions = no class available: avoid php warning here
177
+                    $className = strtolower($hop['class']);
178
+                    if(!empty($className) and ($className == 'logger' or 
179
+                        strtolower(get_parent_class($className)) == 'logger')) {
180
+                        $locationInfo['line'] = $hop['line'];
181
+                        $locationInfo['file'] = $hop['file'];
182
+                        break;
183
+                    }
184
+                }
185
+                $prevHop = $hop;
186
+                $hop = array_pop($trace);
187
+            }
188
+            $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
+            if(isset($prevHop['function']) and
190
+                $prevHop['function'] !== 'include' and
191
+                $prevHop['function'] !== 'include_once' and
192
+                $prevHop['function'] !== 'require' and
193
+                $prevHop['function'] !== 'require_once') {
194 194
 
195
-				$locationInfo['function'] = $prevHop['function'];
196
-			} else {
197
-				$locationInfo['function'] = 'main';
198
-			}
195
+                $locationInfo['function'] = $prevHop['function'];
196
+            } else {
197
+                $locationInfo['function'] = 'main';
198
+            }
199 199
 					 
200
-			$this->locationInfo = new Payone_Log4php_LoggerLocationInfo($locationInfo, $this->fqcn);
201
-		}
202
-		return $this->locationInfo;
203
-	}
200
+            $this->locationInfo = new Payone_Log4php_LoggerLocationInfo($locationInfo, $this->fqcn);
201
+        }
202
+        return $this->locationInfo;
203
+    }
204 204
 
205
-	/**
206
-	 * Return the level of this event. Use this form instead of directly
207
-	 * accessing the {@link $level} field.
208
-	 * @return Payone_Log4php_LoggerLevel
209
-	 */
210
-	public function getLevel() {
211
-		return $this->level;
212
-	}
205
+    /**
206
+     * Return the level of this event. Use this form instead of directly
207
+     * accessing the {@link $level} field.
208
+     * @return Payone_Log4php_LoggerLevel
209
+     */
210
+    public function getLevel() {
211
+        return $this->level;
212
+    }
213 213
 
214
-	/**
215
-	 * Returns the logger which created the event.
216
-	 * @return Logger
217
-	 */
218
-	public function getLogger() {
219
-		return $this->logger;
220
-	}
214
+    /**
215
+     * Returns the logger which created the event.
216
+     * @return Logger
217
+     */
218
+    public function getLogger() {
219
+        return $this->logger;
220
+    }
221 221
 	
222
-	/**
223
-	 * Return the name of the logger. Use this form instead of directly
224
-	 * accessing the {@link $categoryName} field.
225
-	 * @return string  
226
-	 */
227
-	public function getLoggerName() {
228
-		return $this->categoryName;
229
-	}
222
+    /**
223
+     * Return the name of the logger. Use this form instead of directly
224
+     * accessing the {@link $categoryName} field.
225
+     * @return string  
226
+     */
227
+    public function getLoggerName() {
228
+        return $this->categoryName;
229
+    }
230 230
 
231
-	/**
232
-	 * Return the message for this logging event.
233
-	 *
234
-	 * <p>Before serialization, the returned object is the message
235
-	 * passed by the user to generate the logging event. After
236
-	 * serialization, the returned value equals the String form of the
237
-	 * message possibly after object rendering.
238
-	 * @return mixed
239
-	 */
240
-	public function getMessage() {
241
-		if($this->message !== null) {
242
-			return $this->message;
243
-		} else {
244
-			return $this->getRenderedMessage();
245
-		}
246
-	}
231
+    /**
232
+     * Return the message for this logging event.
233
+     *
234
+     * <p>Before serialization, the returned object is the message
235
+     * passed by the user to generate the logging event. After
236
+     * serialization, the returned value equals the String form of the
237
+     * message possibly after object rendering.
238
+     * @return mixed
239
+     */
240
+    public function getMessage() {
241
+        if($this->message !== null) {
242
+            return $this->message;
243
+        } else {
244
+            return $this->getRenderedMessage();
245
+        }
246
+    }
247 247
 
248
-	/**
249
-	 * This method returns the NDC for this event. It will return the
250
-	 * correct content even if the event was generated in a different
251
-	 * thread or even on a different machine. The {@link LoggerNDC::get()} method
252
-	 * should <b>never</b> be called directly.
253
-	 * @return string  
254
-	 */
255
-	public function getNDC() {
256
-		if($this->ndcLookupRequired) {
257
-			$this->ndcLookupRequired = false;
258
-			$this->ndc = Payone_Log4php_LoggerNDC::get();
259
-		}
260
-		return $this->ndc;
261
-	}
248
+    /**
249
+     * This method returns the NDC for this event. It will return the
250
+     * correct content even if the event was generated in a different
251
+     * thread or even on a different machine. The {@link LoggerNDC::get()} method
252
+     * should <b>never</b> be called directly.
253
+     * @return string  
254
+     */
255
+    public function getNDC() {
256
+        if($this->ndcLookupRequired) {
257
+            $this->ndcLookupRequired = false;
258
+            $this->ndc = Payone_Log4php_LoggerNDC::get();
259
+        }
260
+        return $this->ndc;
261
+    }
262 262
 
263
-	/**
264
-	 * Returns the the context corresponding to the <code>key</code>
265
-	 * parameter.
266
-	 * @return string
267
-	 */
268
-	public function getMDC($key) {
269
-		return Payone_Log4php_LoggerMDC::get($key);
270
-	}
263
+    /**
264
+     * Returns the the context corresponding to the <code>key</code>
265
+     * parameter.
266
+     * @return string
267
+     */
268
+    public function getMDC($key) {
269
+        return Payone_Log4php_LoggerMDC::get($key);
270
+    }
271 271
 	
272
-	/**
273
-	 * Returns the entire MDC context.
274
-	 * @return array
275
-	 */
276
-	public function getMDCMap () {
277
-		return Payone_Log4php_LoggerMDC::getMap();
278
-	}
272
+    /**
273
+     * Returns the entire MDC context.
274
+     * @return array
275
+     */
276
+    public function getMDCMap () {
277
+        return Payone_Log4php_LoggerMDC::getMap();
278
+    }
279 279
 
280
-	/**
281
-	 * Render message.
282
-	 * @return string
283
-	 */
284
-	public function getRenderedMessage() {
285
-		if($this->renderedMessage === null and $this->message !== null) {
286
-			if(is_string($this->message)) {
287
-				$this->renderedMessage = $this->message;
288
-			} else {
289
-				$rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
291
-			}
292
-		}
293
-		return $this->renderedMessage;
294
-	}
280
+    /**
281
+     * Render message.
282
+     * @return string
283
+     */
284
+    public function getRenderedMessage() {
285
+        if($this->renderedMessage === null and $this->message !== null) {
286
+            if(is_string($this->message)) {
287
+                $this->renderedMessage = $this->message;
288
+            } else {
289
+                $rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
+                $this->renderedMessage= $rendererMap->findAndRender($this->message);
291
+            }
292
+        }
293
+        return $this->renderedMessage;
294
+    }
295 295
 
296
-	/**
297
-	 * Returns the time when the application started, as a UNIX timestamp 
298
-	 * with microseconds.
299
-	 * @return float
300
-	 */
301
-	public static function getStartTime() {
302
-		if(!isset(self::$startTime)) {
303
-			self::$startTime = microtime(true);
304
-		}
305
-		return self::$startTime; 
306
-	}
296
+    /**
297
+     * Returns the time when the application started, as a UNIX timestamp 
298
+     * with microseconds.
299
+     * @return float
300
+     */
301
+    public static function getStartTime() {
302
+        if(!isset(self::$startTime)) {
303
+            self::$startTime = microtime(true);
304
+        }
305
+        return self::$startTime; 
306
+    }
307 307
 
308
-	/**
309
-	 * @return float
310
-	 */
311
-	public function getTimeStamp() {
312
-		return $this->timeStamp;
313
-	}
308
+    /**
309
+     * @return float
310
+     */
311
+    public function getTimeStamp() {
312
+        return $this->timeStamp;
313
+    }
314 314
 	
315
-	/**
316
-	 * Calculates the time of this event.
317
-	 * @return the time after event starttime when this event has occured
318
-	 */
319
-	public function getTime() {
320
-		$eventTime = $this->getTimeStamp();
321
-		$eventStartTime = Payone_Log4php_LoggerLoggingEvent::getStartTime();
322
-		return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
323
-	}
315
+    /**
316
+     * Calculates the time of this event.
317
+     * @return the time after event starttime when this event has occured
318
+     */
319
+    public function getTime() {
320
+        $eventTime = $this->getTimeStamp();
321
+        $eventStartTime = Payone_Log4php_LoggerLoggingEvent::getStartTime();
322
+        return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
323
+    }
324 324
 	
325
-	/**
326
-	 * @return mixed
327
-	 */
328
-	public function getThreadName() {
329
-		if ($this->threadName === null) {
330
-			$this->threadName = (string)getmypid();
331
-		}
332
-		return $this->threadName;
333
-	}
325
+    /**
326
+     * @return mixed
327
+     */
328
+    public function getThreadName() {
329
+        if ($this->threadName === null) {
330
+            $this->threadName = (string)getmypid();
331
+        }
332
+        return $this->threadName;
333
+    }
334 334
 
335
-	/**
336
-	 * @return mixed LoggerThrowableInformation
337
-	 */
338
-	public function getThrowableInformation() {
339
-		return $this->throwableInfo;
340
-	}
335
+    /**
336
+     * @return mixed LoggerThrowableInformation
337
+     */
338
+    public function getThrowableInformation() {
339
+        return $this->throwableInfo;
340
+    }
341 341
 	
342
-	/**
343
-	 * Serialize this object
344
-	 * @return string
345
-	 */
346
-	public function toString() {
347
-		serialize($this);
348
-	}
342
+    /**
343
+     * Serialize this object
344
+     * @return string
345
+     */
346
+    public function toString() {
347
+        serialize($this);
348
+    }
349 349
 	
350
-	/**
351
-	 * Avoid serialization of the {@link $logger} object
352
-	 */
353
-	public function __sleep() {
354
-		return array(
355
-			'fqcn',
356
-			'categoryName',
357
-			'level',
358
-			'ndc',
359
-			'ndcLookupRequired',
360
-			'message',
361
-			'renderedMessage',
362
-			'threadName',
363
-			'timeStamp',
364
-			'locationInfo',
365
-		);
366
-	}
350
+    /**
351
+     * Avoid serialization of the {@link $logger} object
352
+     */
353
+    public function __sleep() {
354
+        return array(
355
+            'fqcn',
356
+            'categoryName',
357
+            'level',
358
+            'ndc',
359
+            'ndcLookupRequired',
360
+            'message',
361
+            'renderedMessage',
362
+            'threadName',
363
+            'timeStamp',
364
+            'locationInfo',
365
+        );
366
+    }
367 367
 
368 368
 }
369 369
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	*/
128 128
 	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129 129
 		$this->fqcn = $fqcn;
130
-		if($logger instanceof Payone_Log4php_Logger) {
130
+		if ($logger instanceof Payone_Log4php_Logger) {
131 131
 			$this->logger = $logger;
132 132
 			$this->categoryName = $logger->getName();
133 133
 		} else {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		}
136 136
 		$this->level = $priority;
137 137
 		$this->message = $message;
138
-		if($timeStamp !== null && is_float($timeStamp)) {
138
+		if ($timeStamp !== null && is_float($timeStamp)) {
139 139
 			$this->timeStamp = $timeStamp;
140 140
 		} else {
141 141
 			$this->timeStamp = microtime(true);
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 	 * @return Payone_Log4php_LoggerLocationInfo
165 165
 	 */
166 166
 	public function getLocationInformation() {
167
-		if($this->locationInfo === null) {
167
+		if ($this->locationInfo === null) {
168 168
 
169 169
 			$locationInfo = array();
170 170
 			$trace = debug_backtrace();
171 171
 			$prevHop = null;
172 172
 			// make a downsearch to identify the caller
173 173
 			$hop = array_pop($trace);
174
-			while($hop !== null) {
175
-				if(isset($hop['class'])) {
174
+			while ($hop !== null) {
175
+				if (isset($hop['class'])) {
176 176
 					// we are sometimes in functions = no class available: avoid php warning here
177 177
 					$className = strtolower($hop['class']);
178
-					if(!empty($className) and ($className == 'logger' or 
178
+					if (!empty($className) and ($className == 'logger' or 
179 179
 						strtolower(get_parent_class($className)) == 'logger')) {
180 180
 						$locationInfo['line'] = $hop['line'];
181 181
 						$locationInfo['file'] = $hop['file'];
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				$hop = array_pop($trace);
187 187
 			}
188 188
 			$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
-			if(isset($prevHop['function']) and
189
+			if (isset($prevHop['function']) and
190 190
 				$prevHop['function'] !== 'include' and
191 191
 				$prevHop['function'] !== 'include_once' and
192 192
 				$prevHop['function'] !== 'require' and
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return mixed
239 239
 	 */
240 240
 	public function getMessage() {
241
-		if($this->message !== null) {
241
+		if ($this->message !== null) {
242 242
 			return $this->message;
243 243
 		} else {
244 244
 			return $this->getRenderedMessage();
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return string  
254 254
 	 */
255 255
 	public function getNDC() {
256
-		if($this->ndcLookupRequired) {
256
+		if ($this->ndcLookupRequired) {
257 257
 			$this->ndcLookupRequired = false;
258 258
 			$this->ndc = Payone_Log4php_LoggerNDC::get();
259 259
 		}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * Returns the entire MDC context.
274 274
 	 * @return array
275 275
 	 */
276
-	public function getMDCMap () {
276
+	public function getMDCMap() {
277 277
 		return Payone_Log4php_LoggerMDC::getMap();
278 278
 	}
279 279
 
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
 	 * @return string
283 283
 	 */
284 284
 	public function getRenderedMessage() {
285
-		if($this->renderedMessage === null and $this->message !== null) {
286
-			if(is_string($this->message)) {
285
+		if ($this->renderedMessage === null and $this->message !== null) {
286
+			if (is_string($this->message)) {
287 287
 				$this->renderedMessage = $this->message;
288 288
 			} else {
289 289
 				$rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
290
+				$this->renderedMessage = $rendererMap->findAndRender($this->message);
291 291
 			}
292 292
 		}
293 293
 		return $this->renderedMessage;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return float
300 300
 	 */
301 301
 	public static function getStartTime() {
302
-		if(!isset(self::$startTime)) {
302
+		if (!isset(self::$startTime)) {
303 303
 			self::$startTime = microtime(true);
304 304
 		}
305 305
 		return self::$startTime; 
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverter.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -73,6 +73,7 @@
 block discarded – undo
73 73
 	 * converters must implement this method.
74 74
 	 *
75 75
 	 * @param Payone_Log4php_LoggerLoggingEvent $event
76
+	 * @return string
76 77
 	 */
77 78
 	abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
78 79
 
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -33,99 +33,99 @@
 block discarded – undo
33 33
  */
34 34
 abstract class Payone_Log4php_LoggerPatternConverter {
35 35
 	
36
-	/**
37
-	 * Next converter in the converter chain.
38
-	 * @var Payone_Log4php_LoggerPatternConverter
39
-	 */
40
-	public $next = null;
36
+    /**
37
+     * Next converter in the converter chain.
38
+     * @var Payone_Log4php_LoggerPatternConverter
39
+     */
40
+    public $next = null;
41 41
 	
42
-	/**
43
-	 * Formatting information, parsed from pattern modifiers. 
44
-	 * @var Payone_Log4php_LoggerFormattingInfo
45
-	 */
46
-	protected $formattingInfo;
42
+    /**
43
+     * Formatting information, parsed from pattern modifiers. 
44
+     * @var Payone_Log4php_LoggerFormattingInfo
45
+     */
46
+    protected $formattingInfo;
47 47
 	
48
-	/**
49
-	 * Converter-specific formatting options.
50
-	 * @var array
51
-	 */
52
-	protected $option;
48
+    /**
49
+     * Converter-specific formatting options.
50
+     * @var array
51
+     */
52
+    protected $option;
53 53
 
54
-	/**
55
-	 * Constructor 
56
-	 * @param Payone_Log4php_LoggerFormattingInfo $formattingInfo
57
-	 * @param array $option
58
-	 */
59
-	public function __construct(Payone_Log4php_LoggerFormattingInfo $formattingInfo = null, $option = null) {
60
-		$this->formattingInfo = $formattingInfo;
61
-		$this->option = $option;
62
-		$this->activateOptions();
63
-	}
54
+    /**
55
+     * Constructor 
56
+     * @param Payone_Log4php_LoggerFormattingInfo $formattingInfo
57
+     * @param array $option
58
+     */
59
+    public function __construct(Payone_Log4php_LoggerFormattingInfo $formattingInfo = null, $option = null) {
60
+        $this->formattingInfo = $formattingInfo;
61
+        $this->option = $option;
62
+        $this->activateOptions();
63
+    }
64 64
 	
65
-	/**
66
-	 * Called in constructor. Converters which need to process the options 
67
-	 * can override this method. 
68
-	 */
69
-	public function activateOptions() { }
65
+    /**
66
+     * Called in constructor. Converters which need to process the options 
67
+     * can override this method. 
68
+     */
69
+    public function activateOptions() { }
70 70
   
71
-	/**
72
-	 * Converts the logging event to the desired format. Derived pattern 
73
-	 * converters must implement this method.
74
-	 *
75
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
76
-	 */
77
-	abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
71
+    /**
72
+     * Converts the logging event to the desired format. Derived pattern 
73
+     * converters must implement this method.
74
+     *
75
+     * @param Payone_Log4php_LoggerLoggingEvent $event
76
+     */
77
+    abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
78 78
 
79
-	/**
80
-	 * Converts the event and formats it according to setting in the 
81
-	 * Formatting information object.
82
-	 *
83
-	 * @param string &$sbuf string buffer to write to
84
-	 * @param Payone_Log4php_LoggerLoggingEvent $event Event to be formatted.
85
-	 */
86
-	public function format(&$sbuf, $event) {
87
-		$string = $this->convert($event);
79
+    /**
80
+     * Converts the event and formats it according to setting in the 
81
+     * Formatting information object.
82
+     *
83
+     * @param string &$sbuf string buffer to write to
84
+     * @param Payone_Log4php_LoggerLoggingEvent $event Event to be formatted.
85
+     */
86
+    public function format(&$sbuf, $event) {
87
+        $string = $this->convert($event);
88 88
 		
89
-		if (!isset($this->formattingInfo)) {
90
-			$sbuf .= $string;
91
-			return;	
92
-		}
89
+        if (!isset($this->formattingInfo)) {
90
+            $sbuf .= $string;
91
+            return;	
92
+        }
93 93
 		
94
-		$fi = $this->formattingInfo;
94
+        $fi = $this->formattingInfo;
95 95
 		
96
-		// Empty string
97
-		if($string === '' || is_null($string)) {
98
-			if($fi->min > 0) {
99
-				$sbuf .= str_repeat(' ', $fi->min);
100
-			}
101
-			return;
102
-		}
96
+        // Empty string
97
+        if($string === '' || is_null($string)) {
98
+            if($fi->min > 0) {
99
+                $sbuf .= str_repeat(' ', $fi->min);
100
+            }
101
+            return;
102
+        }
103 103
 		
104
-		$len = strlen($string);
104
+        $len = strlen($string);
105 105
 	
106
-		// Trim the string if needed
107
-		if($len > $fi->max) {
108
-			if ($fi->trimLeft) {
109
-				$sbuf .= substr($string, $len - $fi->max, $fi->max);
110
-			} else {
111
-				$sbuf .= substr($string , 0, $fi->max);
112
-			}
113
-		}
106
+        // Trim the string if needed
107
+        if($len > $fi->max) {
108
+            if ($fi->trimLeft) {
109
+                $sbuf .= substr($string, $len - $fi->max, $fi->max);
110
+            } else {
111
+                $sbuf .= substr($string , 0, $fi->max);
112
+            }
113
+        }
114 114
 		
115
-		// Add padding if needed
116
-		else if($len < $fi->min) {
117
-			if($fi->padLeft) {
118
-				$sbuf .= str_repeat(' ', $fi->min - $len);
119
-				$sbuf .= $string;
120
-			} else {
121
-				$sbuf .= $string;
122
-				$sbuf .= str_repeat(' ', $fi->min - $len);
123
-			}
124
-		}
115
+        // Add padding if needed
116
+        else if($len < $fi->min) {
117
+            if($fi->padLeft) {
118
+                $sbuf .= str_repeat(' ', $fi->min - $len);
119
+                $sbuf .= $string;
120
+            } else {
121
+                $sbuf .= $string;
122
+                $sbuf .= str_repeat(' ', $fi->min - $len);
123
+            }
124
+        }
125 125
 		
126
-		// No action needed
127
-		else {
128
-			$sbuf .= $string;
129
-		}
130
-	}
126
+        // No action needed
127
+        else {
128
+            $sbuf .= $string;
129
+        }
130
+    }
131 131
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		$fi = $this->formattingInfo;
95 95
 		
96 96
 		// Empty string
97
-		if($string === '' || is_null($string)) {
98
-			if($fi->min > 0) {
97
+		if ($string === '' || is_null($string)) {
98
+			if ($fi->min > 0) {
99 99
 				$sbuf .= str_repeat(' ', $fi->min);
100 100
 			}
101 101
 			return;
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 		$len = strlen($string);
105 105
 	
106 106
 		// Trim the string if needed
107
-		if($len > $fi->max) {
107
+		if ($len > $fi->max) {
108 108
 			if ($fi->trimLeft) {
109 109
 				$sbuf .= substr($string, $len - $fi->max, $fi->max);
110 110
 			} else {
111
-				$sbuf .= substr($string , 0, $fi->max);
111
+				$sbuf .= substr($string, 0, $fi->max);
112 112
 			}
113 113
 		}
114 114
 		
115 115
 		// Add padding if needed
116
-		else if($len < $fi->min) {
117
-			if($fi->padLeft) {
116
+		else if ($len < $fi->min) {
117
+			if ($fi->padLeft) {
118 118
 				$sbuf .= str_repeat(' ', $fi->min - $len);
119 119
 				$sbuf .= $string;
120 120
 			} else {
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternParser.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@
 block discarded – undo
199 199
 	 * Parses the formatting modifiers and produces the corresponding 
200 200
 	 * LoggerFormattingInfo object.
201 201
 	 * 
202
-	 * @param string $modifier
202
+	 * @param string $modifiers
203 203
 	 * @return Payone_Log4php_LoggerFormattingInfo
204 204
 	 * @throws LoggerException
205 205
 	 */
Please login to merge, or discard this patch.
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -33,206 +33,206 @@
 block discarded – undo
33 33
  */
34 34
 class Payone_Log4php_LoggerPatternParser {
35 35
 
36
-	/** Escape character for conversion words in the conversion pattern. */
37
-	const ESCAPE_CHAR = '%';
36
+    /** Escape character for conversion words in the conversion pattern. */
37
+    const ESCAPE_CHAR = '%';
38 38
 	
39
-	/** Maps conversion words to relevant converters. */
40
-	private $converterMap;
39
+    /** Maps conversion words to relevant converters. */
40
+    private $converterMap;
41 41
 	
42
-	/** Conversion pattern used in layout. */
43
-	private $pattern;
42
+    /** Conversion pattern used in layout. */
43
+    private $pattern;
44 44
 	
45
-	/** Regex pattern used for parsing the conversion pattern. */
46
-	private $regex;
45
+    /** Regex pattern used for parsing the conversion pattern. */
46
+    private $regex;
47 47
 	
48
-	/** 
49
-	 * First converter in the chain. 
50
-	 * @var Payone_Log4php_LoggerPatternConverter
51
-	 */
52
-	private $head;
48
+    /** 
49
+     * First converter in the chain. 
50
+     * @var Payone_Log4php_LoggerPatternConverter
51
+     */
52
+    private $head;
53 53
 	
54
-	/** Last converter in the chain. */
55
-	private $tail;
54
+    /** Last converter in the chain. */
55
+    private $tail;
56 56
 	
57
-	public function __construct($pattern, $converterMap) {
58
-		$this->pattern = $pattern;
59
-		$this->converterMap = $converterMap;
57
+    public function __construct($pattern, $converterMap) {
58
+        $this->pattern = $pattern;
59
+        $this->converterMap = $converterMap;
60 60
 		
61
-		// Construct the regex pattern
62
-		$this->regex = 
63
-			'/' .                       // Starting regex pattern delimiter
64
-			self::ESCAPE_CHAR .         // Character which marks the start of the conversion pattern
65
-			'(?P<modifiers>[0-9.-]*)' . // Format modifiers (optional)
66
-			'(?P<word>[a-zA-Z]+)' .     // The conversion word
67
-			'(?P<option>{[^}]*})?' .   // Conversion option in braces (optional)
68
-			'/';                        // Ending regex pattern delimiter
69
-	}
70
-	
71
-	/** 
72
-	 * Parses the conversion pattern string, converts it to a chain of pattern
73
-	 * converters and returns the first converter in the chain.
74
-	 * 
75
-	 * @return Payone_Log4php_LoggerPatternConverter
76
-	 */
77
-	public function parse() {
61
+        // Construct the regex pattern
62
+        $this->regex = 
63
+            '/' .                       // Starting regex pattern delimiter
64
+            self::ESCAPE_CHAR .         // Character which marks the start of the conversion pattern
65
+            '(?P<modifiers>[0-9.-]*)' . // Format modifiers (optional)
66
+            '(?P<word>[a-zA-Z]+)' .     // The conversion word
67
+            '(?P<option>{[^}]*})?' .   // Conversion option in braces (optional)
68
+            '/';                        // Ending regex pattern delimiter
69
+    }
70
+	
71
+    /** 
72
+     * Parses the conversion pattern string, converts it to a chain of pattern
73
+     * converters and returns the first converter in the chain.
74
+     * 
75
+     * @return Payone_Log4php_LoggerPatternConverter
76
+     */
77
+    public function parse() {
78 78
 		
79
-		// Skip parsing if the pattern is empty
80
-		if (empty($this->pattern)) {
81
-			$this->addLiteral('');
82
-			return $this->head;
83
-		}
79
+        // Skip parsing if the pattern is empty
80
+        if (empty($this->pattern)) {
81
+            $this->addLiteral('');
82
+            return $this->head;
83
+        }
84 84
 		
85
-		// Find all conversion words in the conversion pattern
86
-		$count = preg_match_all($this->regex, $this->pattern, $matches, PREG_OFFSET_CAPTURE);
87
-		if ($count === false) {
88
-			$error = error_get_last();
89
-			throw new Payone_Log4php_LoggerException("Failed parsing layotut pattern: {$error['message']}");
90
-		}
85
+        // Find all conversion words in the conversion pattern
86
+        $count = preg_match_all($this->regex, $this->pattern, $matches, PREG_OFFSET_CAPTURE);
87
+        if ($count === false) {
88
+            $error = error_get_last();
89
+            throw new Payone_Log4php_LoggerException("Failed parsing layotut pattern: {$error['message']}");
90
+        }
91 91
 		
92
-		$prevEnd = 0;
92
+        $prevEnd = 0;
93 93
 		
94
-		foreach($matches[0] as $key => $item) {
94
+        foreach($matches[0] as $key => $item) {
95 95
 			
96
-			// Locate where the conversion command starts and ends
97
-			$length = strlen($item[0]);
98
-			$start = $item[1];
99
-			$end = $item[1] + $length;
96
+            // Locate where the conversion command starts and ends
97
+            $length = strlen($item[0]);
98
+            $start = $item[1];
99
+            $end = $item[1] + $length;
100 100
 		
101
-			// Find any literal expressions between matched commands
102
-			if ($start > $prevEnd) {
103
-				$literal = substr($this->pattern, $prevEnd, $start - $prevEnd);
104
-				$this->addLiteral($literal);
105
-			}
101
+            // Find any literal expressions between matched commands
102
+            if ($start > $prevEnd) {
103
+                $literal = substr($this->pattern, $prevEnd, $start - $prevEnd);
104
+                $this->addLiteral($literal);
105
+            }
106 106
 			
107
-			// Extract the data from the matched command
108
-			$word = !empty($matches['word'][$key]) ? $matches['word'][$key][0] : null;
109
-			$modifiers = !empty($matches['modifiers'][$key]) ? $matches['modifiers'][$key][0] : null;
110
-			$option = !empty($matches['option'][$key]) ? $matches['option'][$key][0] : null;
107
+            // Extract the data from the matched command
108
+            $word = !empty($matches['word'][$key]) ? $matches['word'][$key][0] : null;
109
+            $modifiers = !empty($matches['modifiers'][$key]) ? $matches['modifiers'][$key][0] : null;
110
+            $option = !empty($matches['option'][$key]) ? $matches['option'][$key][0] : null;
111 111
 			
112
-			// Create a converter and add it to the chain
113
-			$this->addConverter($word, $modifiers, $option);
112
+            // Create a converter and add it to the chain
113
+            $this->addConverter($word, $modifiers, $option);
114 114
 			
115
-			$prevEnd = $end;
116
-		}
115
+            $prevEnd = $end;
116
+        }
117 117
 
118
-		// Add any trailing literals
119
-		if ($end < strlen($this->pattern)) {
120
-			$literal = substr($this->pattern, $end);
121
-			$this->addLiteral($literal);
122
-		}
118
+        // Add any trailing literals
119
+        if ($end < strlen($this->pattern)) {
120
+            $literal = substr($this->pattern, $end);
121
+            $this->addLiteral($literal);
122
+        }
123 123
 		
124
-		return $this->head;
125
-	}
126
-	
127
-	/** 
128
-	 * Adds a literal converter to the converter chain. 
129
-	 * @param string $string The string for the literal converter.
130
-	 */
131
-	private function addLiteral($string) {
132
-		$converter = new Payone_Log4php_LoggerPatternConverterLiteral($string);
133
-		$this->addToChain($converter);
134
-	}
135
-	
136
-	/**
137
-	 * Adds a non-literal converter to the converter chain.
138
-	 * 
139
-	 * @param string $word The conversion word, used to determine which 
140
-	 *  converter will be used.
141
-	 * @param string $modifiers Formatting modifiers.
142
-	 * @param string $option Option to pass to the converter.
143
-	 */
144
-	private function addConverter($word, $modifiers, $option) {
145
- 		$formattingInfo = $this->parseModifiers($modifiers);
146
-		$option = trim($option, "{} ");
124
+        return $this->head;
125
+    }
126
+	
127
+    /** 
128
+     * Adds a literal converter to the converter chain. 
129
+     * @param string $string The string for the literal converter.
130
+     */
131
+    private function addLiteral($string) {
132
+        $converter = new Payone_Log4php_LoggerPatternConverterLiteral($string);
133
+        $this->addToChain($converter);
134
+    }
135
+	
136
+    /**
137
+     * Adds a non-literal converter to the converter chain.
138
+     * 
139
+     * @param string $word The conversion word, used to determine which 
140
+     *  converter will be used.
141
+     * @param string $modifiers Formatting modifiers.
142
+     * @param string $option Option to pass to the converter.
143
+     */
144
+    private function addConverter($word, $modifiers, $option) {
145
+            $formattingInfo = $this->parseModifiers($modifiers);
146
+        $option = trim($option, "{} ");
147 147
 		
148
-		if (isset($this->converterMap[$word])) {
149
-			$converter = $this->getConverter($word, $formattingInfo, $option);
150
-			$this->addToChain($converter);	
151
-		} else {
152
-			trigger_error("log4php: Invalid keyword '%$word' in converison pattern. Ignoring keyword.", E_USER_WARNING);
153
-		}
154
-	}
155
-	
156
-	/**
157
-	 * Determines which converter to use based on the conversion word. Creates 
158
-	 * an instance of the converter using the provided formatting info and 
159
-	 * option and returns it.
160
-	 * 
161
-	 * @param string $word The conversion word.
162
-	 * @param Payone_Log4php_LoggerFormattingInfo $info Formatting info.
163
-	 * @param string $option Converter option.
164
-	 * 
165
-	 * @throws LoggerException 
166
-	 * 
167
-	 * @return Payone_Log4php_LoggerPatternConverter
168
-	 */
169
-	private function getConverter($word, $info, $option) {
170
-		if (!isset($this->converterMap[$word])) {
171
-			throw new Payone_Log4php_LoggerException("Invalid keyword '%$word' in converison pattern. Ignoring keyword.");
172
-		}
148
+        if (isset($this->converterMap[$word])) {
149
+            $converter = $this->getConverter($word, $formattingInfo, $option);
150
+            $this->addToChain($converter);	
151
+        } else {
152
+            trigger_error("log4php: Invalid keyword '%$word' in converison pattern. Ignoring keyword.", E_USER_WARNING);
153
+        }
154
+    }
155
+	
156
+    /**
157
+     * Determines which converter to use based on the conversion word. Creates 
158
+     * an instance of the converter using the provided formatting info and 
159
+     * option and returns it.
160
+     * 
161
+     * @param string $word The conversion word.
162
+     * @param Payone_Log4php_LoggerFormattingInfo $info Formatting info.
163
+     * @param string $option Converter option.
164
+     * 
165
+     * @throws LoggerException 
166
+     * 
167
+     * @return Payone_Log4php_LoggerPatternConverter
168
+     */
169
+    private function getConverter($word, $info, $option) {
170
+        if (!isset($this->converterMap[$word])) {
171
+            throw new Payone_Log4php_LoggerException("Invalid keyword '%$word' in converison pattern. Ignoring keyword.");
172
+        }
173 173
 		
174
-		$converterClass = $this->converterMap[$word];
175
-		if(!class_exists($converterClass)) {
176
-			throw new Payone_Log4php_LoggerException("Class '$converterClass' does not exist.");
177
-		}
174
+        $converterClass = $this->converterMap[$word];
175
+        if(!class_exists($converterClass)) {
176
+            throw new Payone_Log4php_LoggerException("Class '$converterClass' does not exist.");
177
+        }
178 178
 		
179
-		$converter = new $converterClass($info, $option);
180
-		if(!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
181
-			throw new Payone_Log4php_LoggerException("Class '$converterClass' is not an instance of Payone_Log4php_LoggerPatternConverter.");
182
-		}
179
+        $converter = new $converterClass($info, $option);
180
+        if(!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
181
+            throw new Payone_Log4php_LoggerException("Class '$converterClass' is not an instance of Payone_Log4php_LoggerPatternConverter.");
182
+        }
183 183
 		
184
-		return $converter;
185
-	}
186
-	
187
-	/** Adds a converter to the chain and updates $head and $tail pointers. */
188
-	private function addToChain(LoggerPatternConverter $converter) {
189
-		if (!isset($this->head)) {
190
-			$this->head = $converter;
191
-			$this->tail = $this->head;
192
-		} else {
193
-			$this->tail->next = $converter;
194
-			$this->tail = $this->tail->next;
195
-		}
196
-	}
197
-	
198
-	/**
199
-	 * Parses the formatting modifiers and produces the corresponding 
200
-	 * LoggerFormattingInfo object.
201
-	 * 
202
-	 * @param string $modifier
203
-	 * @return Payone_Log4php_LoggerFormattingInfo
204
-	 * @throws LoggerException
205
-	 */
206
-	private function parseModifiers($modifiers) {
207
-		$info = new Payone_Log4php_LoggerFormattingInfo();
208
-	
209
-		// If no modifiers are given, return default values
210
-		if (empty($modifiers)) {
211
-			return $info;
212
-		}
213
-	
214
-		// Validate
215
-		$pattern = '/^(-?[0-9]+)?\.?-?[0-9]+$/';
216
-		if (!preg_match($pattern, $modifiers)) {
217
-			trigger_error("log4php: Invalid modifier in conversion pattern: [$modifiers]. Ignoring modifier.", E_USER_WARNING);
218
-			return $info;
219
-		}
220
-	
221
-		$parts = explode('.', $modifiers);
222
-	
223
-		if (!empty($parts[0])) {
224
-			$minPart = (integer) $parts[0];
225
-			$info->min = abs($minPart);
226
-			$info->padLeft = ($minPart > 0);
227
-		}
228
-	
229
-		if (!empty($parts[1])) {
230
-			$maxPart = (integer) $parts[1];
231
-			$info->max = abs($maxPart);
232
-			$info->trimLeft = ($maxPart > 0);
233
-		}
234
-	
235
-		return $info;
236
-	}
184
+        return $converter;
185
+    }
186
+	
187
+    /** Adds a converter to the chain and updates $head and $tail pointers. */
188
+    private function addToChain(LoggerPatternConverter $converter) {
189
+        if (!isset($this->head)) {
190
+            $this->head = $converter;
191
+            $this->tail = $this->head;
192
+        } else {
193
+            $this->tail->next = $converter;
194
+            $this->tail = $this->tail->next;
195
+        }
196
+    }
197
+	
198
+    /**
199
+     * Parses the formatting modifiers and produces the corresponding 
200
+     * LoggerFormattingInfo object.
201
+     * 
202
+     * @param string $modifier
203
+     * @return Payone_Log4php_LoggerFormattingInfo
204
+     * @throws LoggerException
205
+     */
206
+    private function parseModifiers($modifiers) {
207
+        $info = new Payone_Log4php_LoggerFormattingInfo();
208
+	
209
+        // If no modifiers are given, return default values
210
+        if (empty($modifiers)) {
211
+            return $info;
212
+        }
213
+	
214
+        // Validate
215
+        $pattern = '/^(-?[0-9]+)?\.?-?[0-9]+$/';
216
+        if (!preg_match($pattern, $modifiers)) {
217
+            trigger_error("log4php: Invalid modifier in conversion pattern: [$modifiers]. Ignoring modifier.", E_USER_WARNING);
218
+            return $info;
219
+        }
220
+	
221
+        $parts = explode('.', $modifiers);
222
+	
223
+        if (!empty($parts[0])) {
224
+            $minPart = (integer) $parts[0];
225
+            $info->min = abs($minPart);
226
+            $info->padLeft = ($minPart > 0);
227
+        }
228
+	
229
+        if (!empty($parts[1])) {
230
+            $maxPart = (integer) $parts[1];
231
+            $info->max = abs($maxPart);
232
+            $info->trimLeft = ($maxPart > 0);
233
+        }
234
+	
235
+        return $info;
236
+    }
237 237
 }
238 238
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		
61 61
 		// Construct the regex pattern
62 62
 		$this->regex = 
63
-			'/' .                       // Starting regex pattern delimiter
64
-			self::ESCAPE_CHAR .         // Character which marks the start of the conversion pattern
63
+			'/' . // Starting regex pattern delimiter
64
+			self::ESCAPE_CHAR . // Character which marks the start of the conversion pattern
65 65
 			'(?P<modifiers>[0-9.-]*)' . // Format modifiers (optional)
66
-			'(?P<word>[a-zA-Z]+)' .     // The conversion word
67
-			'(?P<option>{[^}]*})?' .   // Conversion option in braces (optional)
68
-			'/';                        // Ending regex pattern delimiter
66
+			'(?P<word>[a-zA-Z]+)' . // The conversion word
67
+			'(?P<option>{[^}]*})?' . // Conversion option in braces (optional)
68
+			'/'; // Ending regex pattern delimiter
69 69
 	}
70 70
 	
71 71
 	/** 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		
92 92
 		$prevEnd = 0;
93 93
 		
94
-		foreach($matches[0] as $key => $item) {
94
+		foreach ($matches[0] as $key => $item) {
95 95
 			
96 96
 			// Locate where the conversion command starts and ends
97 97
 			$length = strlen($item[0]);
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 		}
173 173
 		
174 174
 		$converterClass = $this->converterMap[$word];
175
-		if(!class_exists($converterClass)) {
175
+		if (!class_exists($converterClass)) {
176 176
 			throw new Payone_Log4php_LoggerException("Class '$converterClass' does not exist.");
177 177
 		}
178 178
 		
179 179
 		$converter = new $converterClass($info, $option);
180
-		if(!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
180
+		if (!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
181 181
 			throw new Payone_Log4php_LoggerException("Class '$converterClass' is not an instance of Payone_Log4php_LoggerPatternConverter.");
182 182
 		}
183 183
 		
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		$parts = explode('.', $modifiers);
222 222
 	
223 223
 		if (!empty($parts[0])) {
224
-			$minPart = (integer) $parts[0];
224
+			$minPart = (integer)$parts[0];
225 225
 			$info->min = abs($minPart);
226 226
 			$info->padLeft = ($minPart > 0);
227 227
 		}
228 228
 	
229 229
 		if (!empty($parts[1])) {
230
-			$maxPart = (integer) $parts[1];
230
+			$maxPart = (integer)$parts[1];
231 231
 			$info->max = abs($maxPart);
232 232
 			$info->trimLeft = ($maxPart > 0);
233 233
 		}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerReflectionUtils.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 	/**
124 124
 	 * Creates an instances from the given class name.
125 125
 	 *
126
-	 * @param string $classname
126
+	 * @param string $class
127 127
 	 * @return an object from the class with the given classname
128 128
 	 */
129 129
 	public static function createObject($class) {
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -23,131 +23,131 @@
 block discarded – undo
23 23
  * @package log4php
24 24
  */
25 25
 class Payone_Log4php_LoggerReflectionUtils {
26
-		/** the target object */
27
-	private $obj;
26
+        /** the target object */
27
+    private $obj;
28 28
 	
29
-	/**
30
-	 * Create a new LoggerReflectionUtils for the specified Object. 
31
-	 * This is done in prepartion for invoking {@link setProperty()} 
32
-	 * one or more times.
33
-	 * @param object &$obj the object for which to set properties
34
-	 */
35
-	public function __construct($obj) {
36
-		$this->obj = $obj;
37
-	}
29
+    /**
30
+     * Create a new LoggerReflectionUtils for the specified Object. 
31
+     * This is done in prepartion for invoking {@link setProperty()} 
32
+     * one or more times.
33
+     * @param object &$obj the object for which to set properties
34
+     */
35
+    public function __construct($obj) {
36
+        $this->obj = $obj;
37
+    }
38 38
 	
39
-	/**
40
-	 * Set the properties of an object passed as a parameter in one
41
-	 * go. The <code>properties</code> are parsed relative to a
42
-	 * <code>prefix</code>.
43
-	 *
44
-	 * @param object $obj The object to configure.
45
-	 * @param array $properties An array containing keys and values.
46
-	 * @param string $prefix Only keys having the specified prefix will be set.
47
-	 */
48
-	 // TODO: check, if this is really useful
49
-	public static function setPropertiesByObject($obj, $properties, $prefix) {
50
-		$pSetter = new Payone_Log4php_LoggerReflectionUtils($obj);
51
-		return $pSetter->setProperties($properties, $prefix);
52
-	}
39
+    /**
40
+     * Set the properties of an object passed as a parameter in one
41
+     * go. The <code>properties</code> are parsed relative to a
42
+     * <code>prefix</code>.
43
+     *
44
+     * @param object $obj The object to configure.
45
+     * @param array $properties An array containing keys and values.
46
+     * @param string $prefix Only keys having the specified prefix will be set.
47
+     */
48
+        // TODO: check, if this is really useful
49
+    public static function setPropertiesByObject($obj, $properties, $prefix) {
50
+        $pSetter = new Payone_Log4php_LoggerReflectionUtils($obj);
51
+        return $pSetter->setProperties($properties, $prefix);
52
+    }
53 53
 	
54 54
 	
55
-	/**
56
-	 * Set the properites for the object that match the
57
-	 * <code>prefix</code> passed as parameter.
58
-	 * 
59
-	 * Example:
60
-	 * 
61
-	 * $arr['xxxname'] = 'Joe';
62
- 	 * $arr['xxxmale'] = true;
63
-	 * and prefix xxx causes setName and setMale.	
64
-	 *
65
-	 * @param array $properties An array containing keys and values.
66
-	 * @param string $prefix Only keys having the specified prefix will be set.
67
-	 */
68
-	 // TODO: check, if this is really useful
69
-	public function setProperties($properties, $prefix) {
70
-		$len = strlen($prefix);
71
-		reset($properties);
72
-		while(list($key,) = each($properties)) {
73
-			if(strpos($key, $prefix) === 0) {
74
-				if(strpos($key, '.', ($len + 1)) > 0) {
75
-					continue;
76
-				}
77
-				$value = Payone_Log4php_LoggerOptionConverter::findAndSubst($key, $properties);
78
-				$key = substr($key, $len);
79
-				if($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) {
80
-					continue;
81
-				}
82
-				$this->setProperty($key, $value);
83
-			}
84
-		}
85
-		$this->activate();
86
-	}
55
+    /**
56
+     * Set the properites for the object that match the
57
+     * <code>prefix</code> passed as parameter.
58
+     * 
59
+     * Example:
60
+     * 
61
+     * $arr['xxxname'] = 'Joe';
62
+     * $arr['xxxmale'] = true;
63
+     * and prefix xxx causes setName and setMale.	
64
+     *
65
+     * @param array $properties An array containing keys and values.
66
+     * @param string $prefix Only keys having the specified prefix will be set.
67
+     */
68
+        // TODO: check, if this is really useful
69
+    public function setProperties($properties, $prefix) {
70
+        $len = strlen($prefix);
71
+        reset($properties);
72
+        while(list($key,) = each($properties)) {
73
+            if(strpos($key, $prefix) === 0) {
74
+                if(strpos($key, '.', ($len + 1)) > 0) {
75
+                    continue;
76
+                }
77
+                $value = Payone_Log4php_LoggerOptionConverter::findAndSubst($key, $properties);
78
+                $key = substr($key, $len);
79
+                if($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) {
80
+                    continue;
81
+                }
82
+                $this->setProperty($key, $value);
83
+            }
84
+        }
85
+        $this->activate();
86
+    }
87 87
 	
88
-	/**
89
-	 * Set a property on this PropertySetter's Object. If successful, this
90
-	 * method will invoke a setter method on the underlying Object. The
91
-	 * setter is the one for the specified property name and the value is
92
-	 * determined partly from the setter argument type and partly from the
93
-	 * value specified in the call to this method.
94
-	 *
95
-	 * <p>If the setter expects a String no conversion is necessary.
96
-	 * If it expects an int, then an attempt is made to convert 'value'
97
-	 * to an int using new Integer(value). If the setter expects a boolean,
98
-	 * the conversion is by new Boolean(value).
99
-	 *
100
-	 * @param string $name	name of the property
101
-	 * @param string $value	String value of the property
102
-	 */
103
-	public function setProperty($name, $value) {
104
-		if($value === null) {
105
-			return;
106
-		}
88
+    /**
89
+     * Set a property on this PropertySetter's Object. If successful, this
90
+     * method will invoke a setter method on the underlying Object. The
91
+     * setter is the one for the specified property name and the value is
92
+     * determined partly from the setter argument type and partly from the
93
+     * value specified in the call to this method.
94
+     *
95
+     * <p>If the setter expects a String no conversion is necessary.
96
+     * If it expects an int, then an attempt is made to convert 'value'
97
+     * to an int using new Integer(value). If the setter expects a boolean,
98
+     * the conversion is by new Boolean(value).
99
+     *
100
+     * @param string $name	name of the property
101
+     * @param string $value	String value of the property
102
+     */
103
+    public function setProperty($name, $value) {
104
+        if($value === null) {
105
+            return;
106
+        }
107 107
 		
108
-		$method = "set" . ucfirst($name);
108
+        $method = "set" . ucfirst($name);
109 109
 		
110
-		if(!method_exists($this->obj, $method)) {
111
-			throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
112
-		} else {
113
-			return call_user_func(array($this->obj, $method), $value);
114
-		} 
115
-	}
110
+        if(!method_exists($this->obj, $method)) {
111
+            throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
112
+        } else {
113
+            return call_user_func(array($this->obj, $method), $value);
114
+        } 
115
+    }
116 116
 	
117
-	public function activate() {
118
-		if(method_exists($this->obj, 'activateoptions')) {
119
-			return call_user_func(array($this->obj, 'activateoptions'));
120
-		} 
121
-	}
117
+    public function activate() {
118
+        if(method_exists($this->obj, 'activateoptions')) {
119
+            return call_user_func(array($this->obj, 'activateoptions'));
120
+        } 
121
+    }
122 122
 	
123
-	/**
124
-	 * Creates an instances from the given class name.
125
-	 *
126
-	 * @param string $classname
127
-	 * @return an object from the class with the given classname
128
-	 */
129
-	public static function createObject($class) {
130
-		if(!empty($class)) {
131
-			return new $class();
132
-		}
133
-		return null;
134
-	}
123
+    /**
124
+     * Creates an instances from the given class name.
125
+     *
126
+     * @param string $classname
127
+     * @return an object from the class with the given classname
128
+     */
129
+    public static function createObject($class) {
130
+        if(!empty($class)) {
131
+            return new $class();
132
+        }
133
+        return null;
134
+    }
135 135
 	
136
-	/**
137
-	 * @param object $object
138
-	 * @param string $name
139
-	 * @param mixed $value
140
-	 */
141
-	public static function setter($object, $name, $value) {
142
-		if (empty($name)) {
143
-			return false;
144
-		}
145
-		$methodName = 'set'.ucfirst($name);
146
-		if (method_exists($object, $methodName)) {
147
-			return call_user_func(array($object, $methodName), $value);
148
-		} else {
149
-			return false;
150
-		}
151
-	}
136
+    /**
137
+     * @param object $object
138
+     * @param string $name
139
+     * @param mixed $value
140
+     */
141
+    public static function setter($object, $name, $value) {
142
+        if (empty($name)) {
143
+            return false;
144
+        }
145
+        $methodName = 'set'.ucfirst($name);
146
+        if (method_exists($object, $methodName)) {
147
+            return call_user_func(array($object, $methodName), $value);
148
+        } else {
149
+            return false;
150
+        }
151
+    }
152 152
 	
153 153
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	public function setProperties($properties, $prefix) {
70 70
 		$len = strlen($prefix);
71 71
 		reset($properties);
72
-		while(list($key,) = each($properties)) {
73
-			if(strpos($key, $prefix) === 0) {
74
-				if(strpos($key, '.', ($len + 1)) > 0) {
72
+		while (list($key,) = each($properties)) {
73
+			if (strpos($key, $prefix) === 0) {
74
+				if (strpos($key, '.', ($len + 1)) > 0) {
75 75
 					continue;
76 76
 				}
77 77
 				$value = Payone_Log4php_LoggerOptionConverter::findAndSubst($key, $properties);
78 78
 				$key = substr($key, $len);
79
-				if($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) {
79
+				if ($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) {
80 80
 					continue;
81 81
 				}
82 82
 				$this->setProperty($key, $value);
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
 	 * @param string $value	String value of the property
102 102
 	 */
103 103
 	public function setProperty($name, $value) {
104
-		if($value === null) {
104
+		if ($value === null) {
105 105
 			return;
106 106
 		}
107 107
 		
108 108
 		$method = "set" . ucfirst($name);
109 109
 		
110
-		if(!method_exists($this->obj, $method)) {
111
-			throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
110
+		if (!method_exists($this->obj, $method)) {
111
+			throw new Exception("Error setting log4php property $name to $value: no method $method in class " . get_class($this->obj) . "!");
112 112
 		} else {
113 113
 			return call_user_func(array($this->obj, $method), $value);
114 114
 		} 
115 115
 	}
116 116
 	
117 117
 	public function activate() {
118
-		if(method_exists($this->obj, 'activateoptions')) {
118
+		if (method_exists($this->obj, 'activateoptions')) {
119 119
 			return call_user_func(array($this->obj, 'activateoptions'));
120 120
 		} 
121 121
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return an object from the class with the given classname
128 128
 	 */
129 129
 	public static function createObject($class) {
130
-		if(!empty($class)) {
130
+		if (!empty($class)) {
131 131
 			return new $class();
132 132
 		}
133 133
 		return null;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		if (empty($name)) {
143 143
 			return false;
144 144
 		}
145
-		$methodName = 'set'.ucfirst($name);
145
+		$methodName = 'set' . ucfirst($name);
146 146
 		if (method_exists($object, $methodName)) {
147 147
 			return call_user_func(array($object, $methodName), $value);
148 148
 		} else {
Please login to merge, or discard this patch.