Completed
Push — master ( a010d0...acbc61 )
by Florian
04:56
created
lib/Payone/Log4php/LoggerLayout.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -25,50 +25,50 @@
 block discarded – undo
25 25
  * @package log4php
26 26
  */
27 27
 abstract class Payone_Log4php_LoggerLayout extends Payone_Log4php_LoggerConfigurable {
28
-	/**
29
-	 * Activates options for this layout.
30
-	 * Override this method if you have options to be activated.
31
-	 */
32
-	public function activateOptions() {
33
-		return true;
34
-	}
28
+    /**
29
+     * Activates options for this layout.
30
+     * Override this method if you have options to be activated.
31
+     */
32
+    public function activateOptions() {
33
+        return true;
34
+    }
35 35
 
36
-	/**
37
-	 * Override this method to create your own layout format.
38
-	 *
39
-	 * @param LoggerLoggingEvent
40
-	 * @return string
41
-	 */
42
-	public function format(Payone_Log4php_LoggerLoggingEvent $event) {
43
-		return $event->getRenderedMessage();
44
-	} 
36
+    /**
37
+     * Override this method to create your own layout format.
38
+     *
39
+     * @param LoggerLoggingEvent
40
+     * @return string
41
+     */
42
+    public function format(Payone_Log4php_LoggerLoggingEvent $event) {
43
+        return $event->getRenderedMessage();
44
+    } 
45 45
 	
46
-	/**
47
-	 * Returns the content type output by this layout.
48
-	 * @return string
49
-	 */
50
-	public function getContentType() {
51
-		return "text/plain";
52
-	} 
46
+    /**
47
+     * Returns the content type output by this layout.
48
+     * @return string
49
+     */
50
+    public function getContentType() {
51
+        return "text/plain";
52
+    } 
53 53
 			
54
-	/**
55
-	 * Returns the footer for the layout format.
56
-	 * @return string
57
-	 */
58
-	public function getFooter() {
59
-		return null;
60
-	} 
54
+    /**
55
+     * Returns the footer for the layout format.
56
+     * @return string
57
+     */
58
+    public function getFooter() {
59
+        return null;
60
+    } 
61 61
 
62
-	/**
63
-	 * Returns the header for the layout format.
64
-	 * @return string
65
-	 */
66
-	public function getHeader() {
67
-		return null;
68
-	}
62
+    /**
63
+     * Returns the header for the layout format.
64
+     * @return string
65
+     */
66
+    public function getHeader() {
67
+        return null;
68
+    }
69 69
 	
70
-	/** Triggers a warning for this layout with the given message. */
71
-	protected function warn($message) {
72
-		trigger_error("log4php: [" . get_class($this) . "]: $message", E_USER_WARNING);
73
-	}
70
+    /** Triggers a warning for this layout with the given message. */
71
+    protected function warn($message) {
72
+        trigger_error("log4php: [" . get_class($this) . "]: $message", E_USER_WARNING);
73
+    }
74 74
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLayoutTTCC.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -50,148 +50,148 @@
 block discarded – undo
50 50
  */
51 51
 class Payone_Log4php_LoggerLayoutTTCC extends Payone_Log4php_LoggerLayout {
52 52
 
53
-	// Internal representation of options
54
-	protected $threadPrinting    = true;
55
-	protected $categoryPrefixing = true;
56
-	protected $contextPrinting   = true;
57
-	protected $microSecondsPrinting = true;
53
+    // Internal representation of options
54
+    protected $threadPrinting    = true;
55
+    protected $categoryPrefixing = true;
56
+    protected $contextPrinting   = true;
57
+    protected $microSecondsPrinting = true;
58 58
 	
59
-	/**
60
-	 * @var string date format. See {@link PHP_MANUAL#strftime} for details
61
-	 */
62
-	protected $dateFormat = '%c';
59
+    /**
60
+     * @var string date format. See {@link PHP_MANUAL#strftime} for details
61
+     */
62
+    protected $dateFormat = '%c';
63 63
 
64
-	/**
65
-	 * Constructor
66
-	 *
67
-	 * @param string date format
68
-	 * @see dateFormat
69
-	 */
70
-	public function __construct($dateFormat = '') {
71
-		if (!empty($dateFormat)) {
72
-			$this->dateFormat = $dateFormat;
73
-		}
74
-		return;
75
-	}
64
+    /**
65
+     * Constructor
66
+     *
67
+     * @param string date format
68
+     * @see dateFormat
69
+     */
70
+    public function __construct($dateFormat = '') {
71
+        if (!empty($dateFormat)) {
72
+            $this->dateFormat = $dateFormat;
73
+        }
74
+        return;
75
+    }
76 76
 
77
-	/**
78
-	 * The <b>ThreadPrinting</b> option specifies whether the name of the
79
-	 * current thread is part of log output or not. This is true by default.
80
-	 */
81
-	public function setThreadPrinting($threadPrinting) {
82
-		$this->setBoolean('threadPrinting', $threadPrinting);
83
-	}
77
+    /**
78
+     * The <b>ThreadPrinting</b> option specifies whether the name of the
79
+     * current thread is part of log output or not. This is true by default.
80
+     */
81
+    public function setThreadPrinting($threadPrinting) {
82
+        $this->setBoolean('threadPrinting', $threadPrinting);
83
+    }
84 84
 
85
-	/**
86
-	 * @return boolean Returns value of the <b>ThreadPrinting</b> option.
87
-	 */
88
-	public function getThreadPrinting() {
89
-		return $this->threadPrinting;
90
-	}
85
+    /**
86
+     * @return boolean Returns value of the <b>ThreadPrinting</b> option.
87
+     */
88
+    public function getThreadPrinting() {
89
+        return $this->threadPrinting;
90
+    }
91 91
 
92
-	/**
93
-	 * The <b>CategoryPrefixing</b> option specifies whether {@link Category}
94
-	 * name is part of log output or not. This is true by default.
95
-	 */
96
-	public function setCategoryPrefixing($categoryPrefixing) {
97
-		$this->setBoolean('categoryPrefixing', $categoryPrefixing);
98
-	}
92
+    /**
93
+     * The <b>CategoryPrefixing</b> option specifies whether {@link Category}
94
+     * name is part of log output or not. This is true by default.
95
+     */
96
+    public function setCategoryPrefixing($categoryPrefixing) {
97
+        $this->setBoolean('categoryPrefixing', $categoryPrefixing);
98
+    }
99 99
 
100
-	/**
101
-	 * @return boolean Returns value of the <b>CategoryPrefixing</b> option.
102
-	 */
103
-	public function getCategoryPrefixing() {
104
-		return $this->categoryPrefixing;
105
-	}
100
+    /**
101
+     * @return boolean Returns value of the <b>CategoryPrefixing</b> option.
102
+     */
103
+    public function getCategoryPrefixing() {
104
+        return $this->categoryPrefixing;
105
+    }
106 106
 
107
-	/**
108
-	 * The <b>ContextPrinting</b> option specifies log output will include
109
-	 * the nested context information belonging to the current thread.
110
-	 * This is true by default.
111
-	 */
112
-	public function setContextPrinting($contextPrinting) {
113
-		$this->setBoolean('contextPrinting', $contextPrinting);
114
-	}
107
+    /**
108
+     * The <b>ContextPrinting</b> option specifies log output will include
109
+     * the nested context information belonging to the current thread.
110
+     * This is true by default.
111
+     */
112
+    public function setContextPrinting($contextPrinting) {
113
+        $this->setBoolean('contextPrinting', $contextPrinting);
114
+    }
115 115
 
116
-	/**
117
-	 * @return boolean Returns value of the <b>ContextPrinting</b> option.
118
-	 */
119
-	public function getContextPrinting() {
120
-		return $this->contextPrinting;
121
-	}
116
+    /**
117
+     * @return boolean Returns value of the <b>ContextPrinting</b> option.
118
+     */
119
+    public function getContextPrinting() {
120
+        return $this->contextPrinting;
121
+    }
122 122
 	
123
-	/**
124
-	 * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos
125
-	 * should be printed at the end of timestamp.
126
-	 * This is true by default.
127
-	 */
128
-	public function setMicroSecondsPrinting($microSecondsPrinting) {
129
-		$this->setBoolean('microSecondsPrinting', $microSecondsPrinting);
130
-	}
123
+    /**
124
+     * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos
125
+     * should be printed at the end of timestamp.
126
+     * This is true by default.
127
+     */
128
+    public function setMicroSecondsPrinting($microSecondsPrinting) {
129
+        $this->setBoolean('microSecondsPrinting', $microSecondsPrinting);
130
+    }
131 131
 
132
-	/**
133
-	 * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option.
134
-	 */
135
-	public function getMicroSecondsPrinting() {
136
-		return $this->microSecondsPrinting;
137
-	}
132
+    /**
133
+     * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option.
134
+     */
135
+    public function getMicroSecondsPrinting() {
136
+        return $this->microSecondsPrinting;
137
+    }
138 138
 	
139 139
 	
140
-	public function setDateFormat($dateFormat) {
141
-		$this->setString('dateFormat', $dateFormat);
142
-	}
140
+    public function setDateFormat($dateFormat) {
141
+        $this->setString('dateFormat', $dateFormat);
142
+    }
143 143
 	
144
-	/**
145
-	 * @return string
146
-	 */
147
-	public function getDateFormat() {
148
-		return $this->dateFormat;
149
-	}
144
+    /**
145
+     * @return string
146
+     */
147
+    public function getDateFormat() {
148
+        return $this->dateFormat;
149
+    }
150 150
 
151
-	/**
152
-	 * In addition to the level of the statement and message, the
153
-	 * returned string includes time, thread, category.
154
-	 * <p>Time, thread, category are printed depending on options.
155
-	 *
156
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
157
-	 * @return string
158
-	 */
159
-	public function format(Payone_Log4php_LoggerLoggingEvent $event) {
160
-		$timeStamp = (float)$event->getTimeStamp();
161
-		$format = strftime($this->dateFormat, (int)$timeStamp);
151
+    /**
152
+     * In addition to the level of the statement and message, the
153
+     * returned string includes time, thread, category.
154
+     * <p>Time, thread, category are printed depending on options.
155
+     *
156
+     * @param Payone_Log4php_LoggerLoggingEvent $event
157
+     * @return string
158
+     */
159
+    public function format(Payone_Log4php_LoggerLoggingEvent $event) {
160
+        $timeStamp = (float)$event->getTimeStamp();
161
+        $format = strftime($this->dateFormat, (int)$timeStamp);
162 162
 		
163
-		if ($this->microSecondsPrinting) {
164
-			$usecs = floor(($timeStamp - (int)$timeStamp) * 1000);
165
-			$format .= sprintf(',%03d', $usecs);
166
-		}
163
+        if ($this->microSecondsPrinting) {
164
+            $usecs = floor(($timeStamp - (int)$timeStamp) * 1000);
165
+            $format .= sprintf(',%03d', $usecs);
166
+        }
167 167
 			
168
-		$format .= ' ';
168
+        $format .= ' ';
169 169
 		
170
-		if ($this->threadPrinting) {
171
-			$format .= '['.getmypid().'] ';
172
-		}
170
+        if ($this->threadPrinting) {
171
+            $format .= '['.getmypid().'] ';
172
+        }
173 173
 		
174
-		$level = $event->getLevel();
175
-		$format .= $level.' ';
174
+        $level = $event->getLevel();
175
+        $format .= $level.' ';
176 176
 		
177
-		if($this->categoryPrefixing) {
178
-			$format .= $event->getLoggerName().' ';
179
-		}
177
+        if($this->categoryPrefixing) {
178
+            $format .= $event->getLoggerName().' ';
179
+        }
180 180
 	   
181
-		if($this->contextPrinting) {
182
-			$ndc = $event->getNDC();
183
-			if($ndc != null) {
184
-				$format .= $ndc.' ';
185
-			}
186
-		}
181
+        if($this->contextPrinting) {
182
+            $ndc = $event->getNDC();
183
+            if($ndc != null) {
184
+                $format .= $ndc.' ';
185
+            }
186
+        }
187 187
 		
188
-		$format .= '- '.$event->getRenderedMessage();
189
-		$format .= PHP_EOL;
188
+        $format .= '- '.$event->getRenderedMessage();
189
+        $format .= PHP_EOL;
190 190
 		
191
-		return $format;
192
-	}
191
+        return $format;
192
+    }
193 193
 
194
-	public function ignoresThrowable() {
195
-		return true;
196
-	}
194
+    public function ignoresThrowable() {
195
+        return true;
196
+    }
197 197
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderMail.php 1 patch
Indentation   +45 added lines, -46 removed lines patch added patch discarded remove patch
@@ -47,67 +47,66 @@
 block discarded – undo
47 47
  *      Tue Sep  8 21:51:04 2009,120 [5485] FATAL root - Some critical message!
48 48
  *      Tue Sep  8 21:51:06 2009,120 [5485] FATAL root - Some more critical message!
49 49
  * </pre>
50
-
51 50
  * @version $Revision$
52 51
  * @package log4php
53 52
  * @subpackage appenders
54 53
  */
55 54
 class Payone_Log4php_LoggerAppenderMail extends Payone_Log4php_LoggerAppender {
56 55
 
57
-	/** @var string 'from' field */
58
-	protected $from = null;
56
+    /** @var string 'from' field */
57
+    protected $from = null;
59 58
 
60
-	/** @var string 'subject' field */
61
-	protected $subject = 'Log4php Report';
59
+    /** @var string 'subject' field */
60
+    protected $subject = 'Log4php Report';
62 61
 	
63
-	/** @var string 'to' field */
64
-	protected $to = null;
62
+    /** @var string 'to' field */
63
+    protected $to = null;
65 64
 
66
-	/** @var indiciates if this appender should run in dry mode */
67
-	protected $dry = false;
65
+    /** @var indiciates if this appender should run in dry mode */
66
+    protected $dry = false;
68 67
 
69
-	/** @var string used to create mail body */
70
-	protected $body = '';
68
+    /** @var string used to create mail body */
69
+    protected $body = '';
71 70
 	
72
-	public function close() {
73
-		if($this->closed != true) {
74
-			$from = $this->from;
75
-			$to = $this->to;
71
+    public function close() {
72
+        if($this->closed != true) {
73
+            $from = $this->from;
74
+            $to = $this->to;
76 75
 	
77
-			if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
78
-				$subject = $this->subject;
79
-				if(!$this->dry) {
80
-					mail(
81
-						$to, $subject, 
82
-						$this->layout->getHeader() . $this->body . $this->layout->getFooter(),
83
-						"From: {$from}\r\n");
84
-				} else {
85
-				    echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body;
86
-				}
87
-			}
88
-			$this->closed = true;
89
-		}
90
-	}
76
+            if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
77
+                $subject = $this->subject;
78
+                if(!$this->dry) {
79
+                    mail(
80
+                        $to, $subject, 
81
+                        $this->layout->getHeader() . $this->body . $this->layout->getFooter(),
82
+                        "From: {$from}\r\n");
83
+                } else {
84
+                    echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body;
85
+                }
86
+            }
87
+            $this->closed = true;
88
+        }
89
+    }
91 90
 	
92
-	public function setSubject($subject) {
93
-		$this->setString('subject', $subject);
94
-	}
91
+    public function setSubject($subject) {
92
+        $this->setString('subject', $subject);
93
+    }
95 94
 	
96
-	public function setTo($to) {
97
-		$this->setString('to', $to);
98
-	}
95
+    public function setTo($to) {
96
+        $this->setString('to', $to);
97
+    }
99 98
 
100
-	public function setFrom($from) {
101
-		$this->setString('from', $from);
102
-	}
99
+    public function setFrom($from) {
100
+        $this->setString('from', $from);
101
+    }
103 102
 
104
-	public function setDry($dry) {
105
-		$this->setBoolean('dry', $dry);
106
-	}
103
+    public function setDry($dry) {
104
+        $this->setBoolean('dry', $dry);
105
+    }
107 106
 	
108
-	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
109
-		if($this->layout !== null) {
110
-			$this->body .= $this->layout->format($event);
111
-		}
112
-	}
107
+    public function append(Payone_Log4php_LoggerLoggingEvent $event) {
108
+        if($this->layout !== null) {
109
+            $this->body .= $this->layout->format($event);
110
+        }
111
+    }
113 112
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderSocket.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -36,87 +36,87 @@
 block discarded – undo
36 36
  */ 
37 37
 class Payone_Log4php_LoggerAppenderSocket extends Payone_Log4php_LoggerAppender {
38 38
 	
39
-	/** 
40
-	 * Target host.
41
-	 * @see http://php.net/manual/en/function.fsockopen.php 
42
-	 */
43
-	protected $remoteHost;
44
-	
45
-	/** Target port */
46
-	protected $port = 4446;
47
-	
48
-	/** Connection timeout in ms. */
49
-	protected $timeout;
50
-	
51
-	// ******************************************
52
-	// *** Appender methods                   ***
53
-	// ******************************************
54
-	
55
-	/** Override the default layout to use serialized. */
56
-	public function getDefaultLayout() {
57
-		return new Payone_Log4php_LoggerLayoutSerialized();
58
-	}
59
-	
60
-	public function activateOptions() {
61
-		if (empty($this->remoteHost)) {
62
-			$this->warn("Required parameter [remoteHost] not set. Closing appender.");
63
-			$this->closed = true;
64
-			return;
65
-		}
66
-	
67
-		if (empty($this->timeout)) {
68
-			$this->timeout = ini_get("default_socket_timeout");
69
-		}
70
-	
71
-		$this->closed = false;
72
-	}
73
-	
74
-	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
75
-		$socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout);
76
-		if ($socket === false) {
77
-			$this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender.");
78
-			$this->closed = true;
79
-			return;
80
-		}
81
-	
82
-		if (false === fwrite($socket, $this->layout->format($event))) {
83
-			$this->warn("Error writing to socket. Closing appender.");
84
-			$this->closed = true;
85
-		}
86
-		fclose($socket);
87
-	}
88
-	
89
-	// ******************************************
90
-	// *** Accessor methods                   ***
91
-	// ******************************************
92
-	
93
-	/** Sets the target host. */
94
-	public function setRemoteHost($hostname) {
95
-		$this->setString('remoteHost', $hostname);
96
-	}
97
-	
98
-	/** Sets the target port */
99
-	public function setPort($port) {
100
-		$this->setPositiveInteger('port', $port);
101
-	}
39
+    /** 
40
+     * Target host.
41
+     * @see http://php.net/manual/en/function.fsockopen.php 
42
+     */
43
+    protected $remoteHost;
44
+	
45
+    /** Target port */
46
+    protected $port = 4446;
47
+	
48
+    /** Connection timeout in ms. */
49
+    protected $timeout;
50
+	
51
+    // ******************************************
52
+    // *** Appender methods                   ***
53
+    // ******************************************
54
+	
55
+    /** Override the default layout to use serialized. */
56
+    public function getDefaultLayout() {
57
+        return new Payone_Log4php_LoggerLayoutSerialized();
58
+    }
59
+	
60
+    public function activateOptions() {
61
+        if (empty($this->remoteHost)) {
62
+            $this->warn("Required parameter [remoteHost] not set. Closing appender.");
63
+            $this->closed = true;
64
+            return;
65
+        }
66
+	
67
+        if (empty($this->timeout)) {
68
+            $this->timeout = ini_get("default_socket_timeout");
69
+        }
70
+	
71
+        $this->closed = false;
72
+    }
73
+	
74
+    public function append(Payone_Log4php_LoggerLoggingEvent $event) {
75
+        $socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout);
76
+        if ($socket === false) {
77
+            $this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender.");
78
+            $this->closed = true;
79
+            return;
80
+        }
81
+	
82
+        if (false === fwrite($socket, $this->layout->format($event))) {
83
+            $this->warn("Error writing to socket. Closing appender.");
84
+            $this->closed = true;
85
+        }
86
+        fclose($socket);
87
+    }
88
+	
89
+    // ******************************************
90
+    // *** Accessor methods                   ***
91
+    // ******************************************
92
+	
93
+    /** Sets the target host. */
94
+    public function setRemoteHost($hostname) {
95
+        $this->setString('remoteHost', $hostname);
96
+    }
97
+	
98
+    /** Sets the target port */
99
+    public function setPort($port) {
100
+        $this->setPositiveInteger('port', $port);
101
+    }
102 102
 	 
103
-	/** Sets the timeout. */
104
-	public function setTimeout($timeout) {
105
-		$this->setPositiveInteger('timeout', $timeout);
106
-	}
107
-	
108
-	/** Returns the target host. */
109
-	public function getRemoteHost() {
110
-		return $this->getRemoteHost();
111
-	}
112
-	
113
-	/** Returns the target port. */
114
-	public function getPort() {
115
-		return $this->port;
116
-	}
117
-	
118
-	/** Returns the timeout */
119
-	public function getTimeout() {
120
-		return $this->timeout;
121
-	}
103
+    /** Sets the timeout. */
104
+    public function setTimeout($timeout) {
105
+        $this->setPositiveInteger('timeout', $timeout);
106
+    }
107
+	
108
+    /** Returns the target host. */
109
+    public function getRemoteHost() {
110
+        return $this->getRemoteHost();
111
+    }
112
+	
113
+    /** Returns the target port. */
114
+    public function getPort() {
115
+        return $this->port;
116
+    }
117
+	
118
+    /** Returns the timeout */
119
+    public function getTimeout() {
120
+        return $this->timeout;
121
+    }
122 122
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerConfiguratorDefault.php 1 patch
Indentation   +382 added lines, -382 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class Payone_Log4php_LoggerConfiguratorDefault implements Payone_Log4php_LoggerConfigurator
32 32
 {
33
-	/** XML configuration file format. */
34
-	const FORMAT_XML = 'xml';
33
+    /** XML configuration file format. */
34
+    const FORMAT_XML = 'xml';
35 35
 	
36
-	/** PHP configuration file format. */
37
-	const FORMAT_PHP = 'php';
36
+    /** PHP configuration file format. */
37
+    const FORMAT_PHP = 'php';
38 38
 	
39
-	/** INI (properties) configuration file format. */
40
-	const FORMAT_INI = 'ini';
39
+    /** INI (properties) configuration file format. */
40
+    const FORMAT_INI = 'ini';
41 41
 
42
-	/** Defines which adapter should be used for parsing which format. */
43
-	private $adapters = array(
44
-		self::FORMAT_XML => 'Payone_Log4php_LoggerConfigurationAdapterXML',
45
-		self::FORMAT_INI => 'Payone_Log4php_LoggerConfigurationAdapterINI',
46
-		self::FORMAT_PHP => 'Payone_Log4php_LoggerConfigurationAdapterPHP',
47
-	);
42
+    /** Defines which adapter should be used for parsing which format. */
43
+    private $adapters = array(
44
+        self::FORMAT_XML => 'Payone_Log4php_LoggerConfigurationAdapterXML',
45
+        self::FORMAT_INI => 'Payone_Log4php_LoggerConfigurationAdapterINI',
46
+        self::FORMAT_PHP => 'Payone_Log4php_LoggerConfigurationAdapterPHP',
47
+    );
48 48
 	
49
-	/** Default configuration; used if no configuration file is provided. */
50
-	private static $defaultConfiguration = array(
49
+    /** Default configuration; used if no configuration file is provided. */
50
+    private static $defaultConfiguration = array(
51 51
         'threshold' => 'ALL',
52 52
         'rootLogger' => array(
53 53
             'level' => 'DEBUG',
@@ -61,425 +61,425 @@  discard block
 block discarded – undo
61 61
                 ),
62 62
             ),
63 63
         ),
64
-	);
64
+    );
65 65
 	
66
-	/** Holds the appenders before they are linked to loggers. */
67
-	private $appenders = array();
66
+    /** Holds the appenders before they are linked to loggers. */
67
+    private $appenders = array();
68 68
 	
69
-	/**
70
-	 * Configures log4php based on the given configuration. The input can 
71
-	 * either be a path to the config file, or a PHP array holding the 
72
-	 * configuration. 
73
-	 * 
74
-	 * If no configuration is given, or if the given configuration cannot be
75
-	 * parsed for whatever reason, a warning will be issued, and log4php
76
-	 * will use the default configuration contained in 
77
-	 * {@link $defaultConfiguration}.
78
-	 * 
79
-	 * @param Payone_Log4php_LoggerHierarchy $hierarchy The hierarchy on which to perform
80
-	 * 		the configuration. 
81
-	 * @param string|array $input Either path to the config file or the 
82
-	 * 		configuration as an array. If not set, default configuration 
83
-	 * 		will be used.
84
-	 */
85
-	public function configure(Payone_Log4php_LoggerHierarchy $hierarchy, $input = null) {
86
-		$config = $this->parse($input);
87
-		$this->doConfigure($hierarchy, $config);
88
-	}
69
+    /**
70
+     * Configures log4php based on the given configuration. The input can 
71
+     * either be a path to the config file, or a PHP array holding the 
72
+     * configuration. 
73
+     * 
74
+     * If no configuration is given, or if the given configuration cannot be
75
+     * parsed for whatever reason, a warning will be issued, and log4php
76
+     * will use the default configuration contained in 
77
+     * {@link $defaultConfiguration}.
78
+     * 
79
+     * @param Payone_Log4php_LoggerHierarchy $hierarchy The hierarchy on which to perform
80
+     * 		the configuration. 
81
+     * @param string|array $input Either path to the config file or the 
82
+     * 		configuration as an array. If not set, default configuration 
83
+     * 		will be used.
84
+     */
85
+    public function configure(Payone_Log4php_LoggerHierarchy $hierarchy, $input = null) {
86
+        $config = $this->parse($input);
87
+        $this->doConfigure($hierarchy, $config);
88
+    }
89 89
 	
90
-	/**
91
-	 * Parses the given configuration and returns the parsed configuration
92
-	 * as a PHP array. Does not perform any configuration. 
93
-	 * 
94
-	 * If no configuration is given, or if the given configuration cannot be
95
-	 * parsed for whatever reason, a warning will be issued, and the default 
96
-	 * configuration will be returned ({@link $defaultConfiguration}).
97
-	 * 
98
-	 * @param string|array $input Either path to the config file or the 
99
-	 * 		configuration as an array. If not set, default configuration 
100
-	 * 		will be used.
101
-	 * @return array The parsed configuration.
102
-	 */
103
-	public function parse($input)
104
-	{
105
-		// No input - use default configuration
106
-		if (!isset($input)) {
107
-			$config = self::$defaultConfiguration;
108
-		}
90
+    /**
91
+     * Parses the given configuration and returns the parsed configuration
92
+     * as a PHP array. Does not perform any configuration. 
93
+     * 
94
+     * If no configuration is given, or if the given configuration cannot be
95
+     * parsed for whatever reason, a warning will be issued, and the default 
96
+     * configuration will be returned ({@link $defaultConfiguration}).
97
+     * 
98
+     * @param string|array $input Either path to the config file or the 
99
+     * 		configuration as an array. If not set, default configuration 
100
+     * 		will be used.
101
+     * @return array The parsed configuration.
102
+     */
103
+    public function parse($input)
104
+    {
105
+        // No input - use default configuration
106
+        if (!isset($input)) {
107
+            $config = self::$defaultConfiguration;
108
+        }
109 109
 		
110
-		// Array input - contains configuration within the array
111
-		else if (is_array($input)) {
112
-			$config = $input;
113
-		}
110
+        // Array input - contains configuration within the array
111
+        else if (is_array($input)) {
112
+            $config = $input;
113
+        }
114 114
 		
115
-		// String input - contains path to configuration file
116
-		else if (is_string($input)) {
117
-			try {
118
-				$config = $this->parseFile($input);
119
-			} catch (Payone_Log4php_LoggerException $e) {
120
-				$this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
121
-				$config = self::$defaultConfiguration;
122
-			}
123
-		}
115
+        // String input - contains path to configuration file
116
+        else if (is_string($input)) {
117
+            try {
118
+                $config = $this->parseFile($input);
119
+            } catch (Payone_Log4php_LoggerException $e) {
120
+                $this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
121
+                $config = self::$defaultConfiguration;
122
+            }
123
+        }
124 124
 		
125
-		// Anything else is an error
126
-		else {
127
-			$this->warn("Invalid configuration param given. Reverting to default configuration.");
128
-			$config = self::$defaultConfiguration;
129
-		}
125
+        // Anything else is an error
126
+        else {
127
+            $this->warn("Invalid configuration param given. Reverting to default configuration.");
128
+            $config = self::$defaultConfiguration;
129
+        }
130 130
 		
131
-		return $config;
132
-	}
131
+        return $config;
132
+    }
133 133
 
134
-	/** 
135
-	 * Returns the default log4php configuration.
136
-	 * @return array
137
-	 */
138
-	public static function getDefaultConfiguration() {
139
-		return self::$defaultConfiguration;
140
-	} 
134
+    /** 
135
+     * Returns the default log4php configuration.
136
+     * @return array
137
+     */
138
+    public static function getDefaultConfiguration() {
139
+        return self::$defaultConfiguration;
140
+    } 
141 141
 	
142
-	/**
143
-	 * Loads the configuration file from the given URL, determines which
144
-	 * adapter to use, converts the configuration to a PHP array and
145
-	 * returns it.
146
-	 *
147
-	 * @param string $url Path to the config file.
148
-	 * @return The configuration from the config file, as a PHP array.
149
-	 * @throws LoggerException If the configuration file cannot be loaded, or
150
-	 * 		if the parsing fails.
151
-	 */
152
-	private function parseFile($url) {
142
+    /**
143
+     * Loads the configuration file from the given URL, determines which
144
+     * adapter to use, converts the configuration to a PHP array and
145
+     * returns it.
146
+     *
147
+     * @param string $url Path to the config file.
148
+     * @return The configuration from the config file, as a PHP array.
149
+     * @throws LoggerException If the configuration file cannot be loaded, or
150
+     * 		if the parsing fails.
151
+     */
152
+    private function parseFile($url) {
153 153
 		
154
-		if (!file_exists($url)) {
155
-			throw new Payone_Log4php_LoggerException("File not found at [$url].");
156
-		}
154
+        if (!file_exists($url)) {
155
+            throw new Payone_Log4php_LoggerException("File not found at [$url].");
156
+        }
157 157
 		
158
-		$type = $this->getConfigType($url);
159
-		$adapterClass = $this->adapters[$type];
158
+        $type = $this->getConfigType($url);
159
+        $adapterClass = $this->adapters[$type];
160 160
 
161
-		$adapter = new $adapterClass();
162
-		return $adapter->convert($url);
163
-	}
161
+        $adapter = new $adapterClass();
162
+        return $adapter->convert($url);
163
+    }
164 164
 	
165
-	/** Determines configuration file type based on the file extension. */
166
-	private function getConfigType($url) {
167
-		$info = pathinfo($url);
168
-		$ext = strtolower($info['extension']);
165
+    /** Determines configuration file type based on the file extension. */
166
+    private function getConfigType($url) {
167
+        $info = pathinfo($url);
168
+        $ext = strtolower($info['extension']);
169 169
 		
170
-		switch($ext) {
171
-			case 'xml':
172
-				return self::FORMAT_XML;
170
+        switch($ext) {
171
+            case 'xml':
172
+                return self::FORMAT_XML;
173 173
 			
174
-			case 'ini':
175
-			case 'properties':
176
-				return self::FORMAT_INI;
174
+            case 'ini':
175
+            case 'properties':
176
+                return self::FORMAT_INI;
177 177
 			
178
-			case 'php':
179
-				return self::FORMAT_PHP;
178
+            case 'php':
179
+                return self::FORMAT_PHP;
180 180
 				
181
-			default:
182
-				throw new Payone_Log4php_LoggerException("Unsupported configuration file extension: $ext");
183
-		}
184
-	}
181
+            default:
182
+                throw new Payone_Log4php_LoggerException("Unsupported configuration file extension: $ext");
183
+        }
184
+    }
185 185
 	
186
-	/**
187
-	 * Constructs the logger hierarchy based on configuration.
188
-	 * 
189
-	 * @param Payone_Log4php_LoggerHierarchy $hierarchy
190
-	 * @param array $config
191
-	 */
192
-	private function doConfigure(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
193
-		if (isset($config['threshold'])) {
194
-			$threshold = Payone_Log4php_LoggerLevel::toLevel($config['threshold']);
195
-			if (isset($threshold)) {
196
-				$hierarchy->setThreshold($threshold);
197
-			} else {
198
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
199
-			}
200
-		}
186
+    /**
187
+     * Constructs the logger hierarchy based on configuration.
188
+     * 
189
+     * @param Payone_Log4php_LoggerHierarchy $hierarchy
190
+     * @param array $config
191
+     */
192
+    private function doConfigure(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
193
+        if (isset($config['threshold'])) {
194
+            $threshold = Payone_Log4php_LoggerLevel::toLevel($config['threshold']);
195
+            if (isset($threshold)) {
196
+                $hierarchy->setThreshold($threshold);
197
+            } else {
198
+                $this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
199
+            }
200
+        }
201 201
 		
202
-		// Configure appenders and add them to the appender pool
203
-		if (isset($config['appenders']) && is_array($config['appenders'])) {
204
-			foreach($config['appenders'] as $name => $appenderConfig) {
205
-				$this->configureAppender($name, $appenderConfig);
206
-			}
207
-		}
202
+        // Configure appenders and add them to the appender pool
203
+        if (isset($config['appenders']) && is_array($config['appenders'])) {
204
+            foreach($config['appenders'] as $name => $appenderConfig) {
205
+                $this->configureAppender($name, $appenderConfig);
206
+            }
207
+        }
208 208
 		
209
-		// Configure root logger 
210
-		if (isset($config['rootLogger'])) {
211
-			$this->configureRootLogger($hierarchy, $config['rootLogger']);
212
-		}
209
+        // Configure root logger 
210
+        if (isset($config['rootLogger'])) {
211
+            $this->configureRootLogger($hierarchy, $config['rootLogger']);
212
+        }
213 213
 		
214
-		// Configure loggers
215
-		if (isset($config['loggers']) && is_array($config['loggers'])) {
216
-			foreach($config['loggers'] as $loggerName => $loggerConfig) {
217
-				$this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
218
-			}
219
-		}
214
+        // Configure loggers
215
+        if (isset($config['loggers']) && is_array($config['loggers'])) {
216
+            foreach($config['loggers'] as $loggerName => $loggerConfig) {
217
+                $this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
218
+            }
219
+        }
220 220
 
221
-		// Configure renderers
222
-		if (isset($config['renderers']) && is_array($config['renderers'])) {
223
-			foreach($config['renderers'] as $rendererConfig) {
224
-				$this->configureRenderer($hierarchy, $rendererConfig);
225
-			}
226
-		}
227
-	}
221
+        // Configure renderers
222
+        if (isset($config['renderers']) && is_array($config['renderers'])) {
223
+            foreach($config['renderers'] as $rendererConfig) {
224
+                $this->configureRenderer($hierarchy, $rendererConfig);
225
+            }
226
+        }
227
+    }
228 228
 	
229
-	private function configureRenderer(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
230
-		if (!isset($config['renderingClass'])) {
231
-			$this->warn("Rendering class not specified. Skipping renderers definition.");
232
-			return;			
233
-		}
229
+    private function configureRenderer(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
230
+        if (!isset($config['renderingClass'])) {
231
+            $this->warn("Rendering class not specified. Skipping renderers definition.");
232
+            return;			
233
+        }
234 234
 		
235
-		$renderingClass = $config['renderingClass'];
236
-		if (!class_exists($renderingClass)) {
237
-			$this->warn("Nonexistant rendering class [$renderingClass] specified. Skipping renderers definition.");
238
-			return;
239
-		}
235
+        $renderingClass = $config['renderingClass'];
236
+        if (!class_exists($renderingClass)) {
237
+            $this->warn("Nonexistant rendering class [$renderingClass] specified. Skipping renderers definition.");
238
+            return;
239
+        }
240 240
 		
241
-		$renderingClassInstance = new $renderingClass();
242
-		if (!$renderingClassInstance instanceof Payone_Log4php_LoggerRendererObject) {
243
-			$this->warn("Invalid class [$renderingClass] given. Not a valid Payone_Log4php_LoggerRenderer class. Skipping renderers definition.");
244
-			return;			
245
-		}
241
+        $renderingClassInstance = new $renderingClass();
242
+        if (!$renderingClassInstance instanceof Payone_Log4php_LoggerRendererObject) {
243
+            $this->warn("Invalid class [$renderingClass] given. Not a valid Payone_Log4php_LoggerRenderer class. Skipping renderers definition.");
244
+            return;			
245
+        }
246 246
 	
247
-		if (!isset($config['renderedClass'])) {
248
-			$this->warn("Rendered class not specified for rendering Class [$renderingClass]. Skipping renderers definition.");
249
-			return;			
250
-		}
247
+        if (!isset($config['renderedClass'])) {
248
+            $this->warn("Rendered class not specified for rendering Class [$renderingClass]. Skipping renderers definition.");
249
+            return;			
250
+        }
251 251
 		
252
-		$renderedClass = $config['renderedClass'];
253
-		if (!class_exists($renderedClass)) {
254
-			$this->warn("Nonexistant rendered class [$renderedClass] specified for renderer [$renderingClass]. Skipping renderers definition.");
255
-			return;
256
-		}		
252
+        $renderedClass = $config['renderedClass'];
253
+        if (!class_exists($renderedClass)) {
254
+            $this->warn("Nonexistant rendered class [$renderedClass] specified for renderer [$renderingClass]. Skipping renderers definition.");
255
+            return;
256
+        }		
257 257
 
258
-		$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClassInstance);
259
-	}
258
+        $hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClassInstance);
259
+    }
260 260
 	
261
-	/** 
262
-	 * Configures an appender based on given config and saves it to 
263
-	 * {@link $appenders} array so it can be later linked to loggers. 
264
-	 * @param string $name Appender name. 
265
-	 * @param array $config Appender configuration options.
266
-	 */
267
-	private function configureAppender($name, $config) {
261
+    /** 
262
+     * Configures an appender based on given config and saves it to 
263
+     * {@link $appenders} array so it can be later linked to loggers. 
264
+     * @param string $name Appender name. 
265
+     * @param array $config Appender configuration options.
266
+     */
267
+    private function configureAppender($name, $config) {
268 268
 
269
-		// TODO: add this check to other places where it might be useful
270
-		if (!is_array($config)) {
271
-			$type = gettype($config);
272
-			$this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
273
-			return;
274
-		}
269
+        // TODO: add this check to other places where it might be useful
270
+        if (!is_array($config)) {
271
+            $type = gettype($config);
272
+            $this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
273
+            return;
274
+        }
275 275
 		
276
-		// Parse appender class
277
-		$class = $config['class'];
278
-		if (empty($class)) {
279
-			$this->warn("No class given for appender [$name]. Skipping appender definition.");
280
-			return;
281
-		}
282
-		if (!class_exists($class)) {
283
-			$this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
284
-			return;
285
-		}
276
+        // Parse appender class
277
+        $class = $config['class'];
278
+        if (empty($class)) {
279
+            $this->warn("No class given for appender [$name]. Skipping appender definition.");
280
+            return;
281
+        }
282
+        if (!class_exists($class)) {
283
+            $this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
284
+            return;
285
+        }
286 286
 		
287
-		// Instantiate the appender
288
-		$appender = new $class($name);
289
-		if (!($appender instanceof Payone_Log4php_LoggerAppender)) {
290
-			$this->warn("Invalid class [$class] given for appender [$name]. Not a valid Payone_Log4php_LoggerAppender class. Skipping appender definition.");
291
-			return;
292
-		}
287
+        // Instantiate the appender
288
+        $appender = new $class($name);
289
+        if (!($appender instanceof Payone_Log4php_LoggerAppender)) {
290
+            $this->warn("Invalid class [$class] given for appender [$name]. Not a valid Payone_Log4php_LoggerAppender class. Skipping appender definition.");
291
+            return;
292
+        }
293 293
 		
294
-		// Parse the appender threshold
295
-		if (isset($config['threshold'])) {
296
-			$threshold = Payone_Log4php_LoggerLevel::toLevel($config['threshold']);
297
-			if ($threshold instanceof Payone_Log4php_LoggerLevel) {
298
-				$appender->setThreshold($threshold);
299
-			} else {
300
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
301
-			}
302
-		}
294
+        // Parse the appender threshold
295
+        if (isset($config['threshold'])) {
296
+            $threshold = Payone_Log4php_LoggerLevel::toLevel($config['threshold']);
297
+            if ($threshold instanceof Payone_Log4php_LoggerLevel) {
298
+                $appender->setThreshold($threshold);
299
+            } else {
300
+                $this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
301
+            }
302
+        }
303 303
 		
304
-		// Parse the appender layout
305
-		if ($appender->requiresLayout() && isset($config['layout'])) {
306
-			$this->createAppenderLayout($appender, $config['layout']);
307
-		}
304
+        // Parse the appender layout
305
+        if ($appender->requiresLayout() && isset($config['layout'])) {
306
+            $this->createAppenderLayout($appender, $config['layout']);
307
+        }
308 308
 		
309
-		// Parse filters
310
-		if (isset($config['filters']) && is_array($config['filters'])) {
311
-			foreach($config['filters'] as $filterConfig) {
312
-				$this->createAppenderFilter($appender, $filterConfig);
313
-			}
314
-		}
309
+        // Parse filters
310
+        if (isset($config['filters']) && is_array($config['filters'])) {
311
+            foreach($config['filters'] as $filterConfig) {
312
+                $this->createAppenderFilter($appender, $filterConfig);
313
+            }
314
+        }
315 315
 		
316
-		// Set options if any
317
-		if (isset($config['params'])) {
318
-			$this->setOptions($appender, $config['params']);
319
-		}
316
+        // Set options if any
317
+        if (isset($config['params'])) {
318
+            $this->setOptions($appender, $config['params']);
319
+        }
320 320
 
321
-		// Activate and save for later linking to loggers
322
-		$appender->activateOptions();
323
-		$this->appenders[$name] = $appender;
324
-	}
321
+        // Activate and save for later linking to loggers
322
+        $appender->activateOptions();
323
+        $this->appenders[$name] = $appender;
324
+    }
325 325
 	
326
-	/**
327
-	 * Parses layout config, creates the layout and links it to the appender.
328
-	 * @param Payone_Log4php_LoggerAppender $appender
329
-	 * @param array $config Layout configuration.
330
-	 */
331
-	private function createAppenderLayout(Payone_Log4php_LoggerAppender $appender, $config) {
332
-		$name = $appender->getName();
333
-		$class = $config['class'];
334
-		if (empty($class)) {
335
-			$this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
336
-			return;
337
-		}
338
-		if (!class_exists($class)) {
339
-			$this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
340
-			return;
341
-		}
326
+    /**
327
+     * Parses layout config, creates the layout and links it to the appender.
328
+     * @param Payone_Log4php_LoggerAppender $appender
329
+     * @param array $config Layout configuration.
330
+     */
331
+    private function createAppenderLayout(Payone_Log4php_LoggerAppender $appender, $config) {
332
+        $name = $appender->getName();
333
+        $class = $config['class'];
334
+        if (empty($class)) {
335
+            $this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
336
+            return;
337
+        }
338
+        if (!class_exists($class)) {
339
+            $this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
340
+            return;
341
+        }
342 342
 		
343
-		$layout = new $class();
344
-		if (!($layout instanceof Payone_Log4php_LoggerLayout)) {
345
-			$this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
346
-			return;
347
-		}
343
+        $layout = new $class();
344
+        if (!($layout instanceof Payone_Log4php_LoggerLayout)) {
345
+            $this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
346
+            return;
347
+        }
348 348
 		
349
-		if (isset($config['params'])) {
350
-			$this->setOptions($layout, $config['params']);
351
-		}
349
+        if (isset($config['params'])) {
350
+            $this->setOptions($layout, $config['params']);
351
+        }
352 352
 		
353
-		$layout->activateOptions();
354
-		$appender->setLayout($layout);
355
-	}
353
+        $layout->activateOptions();
354
+        $appender->setLayout($layout);
355
+    }
356 356
 	
357
-	/**
358
-	 * Parses filter config, creates the filter and adds it to the appender's 
359
-	 * filter chain.
360
-	 * @param Payone_Log4php_LoggerAppender $appender
361
-	 * @param array $config Filter configuration.
362
-	 */
363
-	private function createAppenderFilter(Payone_Log4php_LoggerAppender $appender, $config) {
364
-		$name = $appender->getName();
365
-		$class = $config['class'];
366
-		if (!class_exists($class)) {
367
-			$this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
368
-			return;
369
-		}
357
+    /**
358
+     * Parses filter config, creates the filter and adds it to the appender's 
359
+     * filter chain.
360
+     * @param Payone_Log4php_LoggerAppender $appender
361
+     * @param array $config Filter configuration.
362
+     */
363
+    private function createAppenderFilter(Payone_Log4php_LoggerAppender $appender, $config) {
364
+        $name = $appender->getName();
365
+        $class = $config['class'];
366
+        if (!class_exists($class)) {
367
+            $this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
368
+            return;
369
+        }
370 370
 	
371
-		$filter = new $class();
372
-		if (!($filter instanceof Payone_Log4php_LoggerFilter)) {
373
-			$this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
374
-			return;
375
-		}
371
+        $filter = new $class();
372
+        if (!($filter instanceof Payone_Log4php_LoggerFilter)) {
373
+            $this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
374
+            return;
375
+        }
376 376
 	
377
-		if (isset($config['params'])) {
378
-			$this->setOptions($filter, $config['params']);
379
-		}
377
+        if (isset($config['params'])) {
378
+            $this->setOptions($filter, $config['params']);
379
+        }
380 380
 	
381
-		$filter->activateOptions();
382
-		$appender->addFilter($filter);
383
-	}
381
+        $filter->activateOptions();
382
+        $appender->addFilter($filter);
383
+    }
384 384
 	
385
-	/** 
386
-	 * Configures the root logger
387
-	 * @see configureLogger() 
388
-	 */
389
-	private function configureRootLogger(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
390
-		$logger = $hierarchy->getRootLogger();
391
-		$this->configureLogger($logger, $config);
392
-	}
385
+    /** 
386
+     * Configures the root logger
387
+     * @see configureLogger() 
388
+     */
389
+    private function configureRootLogger(Payone_Log4php_LoggerHierarchy $hierarchy, $config) {
390
+        $logger = $hierarchy->getRootLogger();
391
+        $this->configureLogger($logger, $config);
392
+    }
393 393
 
394
-	/**
395
-	 * Configures a logger which is not root.
396
-	 * @see configureLogger()
397
-	 */
398
-	private function configureOtherLogger(Payone_Log4php_LoggerHierarchy $hierarchy, $name, $config) {
399
-		// Get logger from hierarchy (this creates it if it doesn't already exist)
400
-		$logger = $hierarchy->getLogger($name);
401
-		$this->configureLogger($logger, $config);
402
-	}
394
+    /**
395
+     * Configures a logger which is not root.
396
+     * @see configureLogger()
397
+     */
398
+    private function configureOtherLogger(Payone_Log4php_LoggerHierarchy $hierarchy, $name, $config) {
399
+        // Get logger from hierarchy (this creates it if it doesn't already exist)
400
+        $logger = $hierarchy->getLogger($name);
401
+        $this->configureLogger($logger, $config);
402
+    }
403 403
 	
404
-	/**
405
-	 * Configures a logger. 
406
-	 * 
407
-	 * @param Logger $logger The logger to configure
408
-	 * @param array $config Logger configuration options.
409
-	 */
410
-	private function configureLogger(Payone_Log4php_Logger $logger, $config) {
411
-		$loggerName = $logger->getName();
404
+    /**
405
+     * Configures a logger. 
406
+     * 
407
+     * @param Logger $logger The logger to configure
408
+     * @param array $config Logger configuration options.
409
+     */
410
+    private function configureLogger(Payone_Log4php_Logger $logger, $config) {
411
+        $loggerName = $logger->getName();
412 412
 		
413
-		// Set logger level
414
-		if (isset($config['level'])) {
415
-			$level = Payone_Log4php_LoggerLevel::toLevel($config['level']);
416
-			if (isset($level)) {
417
-				$logger->setLevel($level);
418
-			} else {
419
-				$default = $logger->getLevel();
420
-				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
421
-			}
422
-		}
413
+        // Set logger level
414
+        if (isset($config['level'])) {
415
+            $level = Payone_Log4php_LoggerLevel::toLevel($config['level']);
416
+            if (isset($level)) {
417
+                $logger->setLevel($level);
418
+            } else {
419
+                $default = $logger->getLevel();
420
+                $this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
421
+            }
422
+        }
423 423
 		
424
-		// Link appenders to logger
425
-		if (isset($config['appenders'])) {
426
-			foreach($config['appenders'] as $appenderName) {
427
-				if (isset($this->appenders[$appenderName])) {
428
-					$logger->addAppender($this->appenders[$appenderName]);
429
-				} else {
430
-					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
431
-				}
432
-			}
433
-		}
424
+        // Link appenders to logger
425
+        if (isset($config['appenders'])) {
426
+            foreach($config['appenders'] as $appenderName) {
427
+                if (isset($this->appenders[$appenderName])) {
428
+                    $logger->addAppender($this->appenders[$appenderName]);
429
+                } else {
430
+                    $this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
431
+                }
432
+            }
433
+        }
434 434
 		
435
-		// Set logger additivity
436
-		if (isset($config['additivity'])) {
437
-			$additivity = Payone_Log4php_LoggerOptionConverter::toBoolean($config['additivity'], null);
438
-			if (is_bool($additivity)) {
439
-				$logger->setAdditivity($additivity);
440
-			} else {
441
-				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
442
-			}
443
-		}
444
-	}
435
+        // Set logger additivity
436
+        if (isset($config['additivity'])) {
437
+            $additivity = Payone_Log4php_LoggerOptionConverter::toBoolean($config['additivity'], null);
438
+            if (is_bool($additivity)) {
439
+                $logger->setAdditivity($additivity);
440
+            } else {
441
+                $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
442
+            }
443
+        }
444
+    }
445 445
 
446
-	/**
447
-	 * Helper method which applies given options to an object which has setters
448
-	 * for these options (such as appenders, layouts, etc.).
449
-	 * 
450
-	 * For example, if options are:
451
-	 * <code>
452
-	 * array(
453
-	 * 	'file' => '/tmp/myfile.log',
454
-	 * 	'append' => true
455
-	 * )
456
-	 * </code>
457
-	 * 
458
-	 * This method will call:
459
-	 * <code>
460
-	 * $object->setFile('/tmp/myfile.log')
461
-	 * $object->setAppend(true)
462
-	 * </code>
463
-	 * 
464
-	 * If required setters do not exist, it will produce a warning. 
465
-	 * 
466
-	 * @param mixed $object The object to configure.
467
-	 * @param unknown_type $options
468
-	 */
469
-	private function setOptions($object, $options) {
470
-		foreach($options as $name => $value) {
471
-			$setter = "set$name";
472
-			if (method_exists($object, $setter)) {
473
-				$object->$setter($value);
474
-			} else {
475
-				$class = get_class($object);
476
-				$this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
477
-			}
478
-		}
479
-	}
446
+    /**
447
+     * Helper method which applies given options to an object which has setters
448
+     * for these options (such as appenders, layouts, etc.).
449
+     * 
450
+     * For example, if options are:
451
+     * <code>
452
+     * array(
453
+     * 	'file' => '/tmp/myfile.log',
454
+     * 	'append' => true
455
+     * )
456
+     * </code>
457
+     * 
458
+     * This method will call:
459
+     * <code>
460
+     * $object->setFile('/tmp/myfile.log')
461
+     * $object->setAppend(true)
462
+     * </code>
463
+     * 
464
+     * If required setters do not exist, it will produce a warning. 
465
+     * 
466
+     * @param mixed $object The object to configure.
467
+     * @param unknown_type $options
468
+     */
469
+    private function setOptions($object, $options) {
470
+        foreach($options as $name => $value) {
471
+            $setter = "set$name";
472
+            if (method_exists($object, $setter)) {
473
+                $object->$setter($value);
474
+            } else {
475
+                $class = get_class($object);
476
+                $this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
477
+            }
478
+        }
479
+    }
480 480
 	
481
-	/** Helper method to simplify error reporting. */
482
-	private function warn($message) {
483
-		trigger_error("log4php: $message", E_USER_WARNING);
484
-	}
481
+    /** Helper method to simplify error reporting. */
482
+    private function warn($message) {
483
+        trigger_error("log4php: $message", E_USER_WARNING);
484
+    }
485 485
 }
486 486
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverter.php 1 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.
lib/Payone/Log4php/LoggerAppenderDailyFile.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -52,59 +52,59 @@
 block discarded – undo
52 52
  */
53 53
 class Payone_Log4php_LoggerAppenderDailyFile extends Payone_Log4php_LoggerAppenderFile {
54 54
 
55
-	/**
56
-	 * Format date. 
57
-	 * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
58
-	 * @var string
59
-	 */
60
-	protected $datePattern = "Ymd";
55
+    /**
56
+     * Format date. 
57
+     * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
58
+     * @var string
59
+     */
60
+    protected $datePattern = "Ymd";
61 61
 	
62
-	/**
63
-	 * Sets date format for the file name.
64
-	 * @param string $datePattern a regular date() string format
65
-	 */
66
-	public function setDatePattern($datePattern) {
67
-		$this->setString('datePattern', $datePattern);
68
-	}
62
+    /**
63
+     * Sets date format for the file name.
64
+     * @param string $datePattern a regular date() string format
65
+     */
66
+    public function setDatePattern($datePattern) {
67
+        $this->setString('datePattern', $datePattern);
68
+    }
69 69
 	
70
-	/**
71
-	 * @return string returns date format for the filename
72
-	 */
73
-	public function getDatePattern() {
74
-		return $this->datePattern;
75
-	}
70
+    /**
71
+     * @return string returns date format for the filename
72
+     */
73
+    public function getDatePattern() {
74
+        return $this->datePattern;
75
+    }
76 76
 	
77
-	/** 
78
-	 * Similar to parent method, but but replaces "%s" in the file name with 
79
-	 * the current date in format specified by the 'datePattern' parameter.
80
-	 */ 
81
-	public function activateOptions() {
82
-		$fileName = $this->getFile();
83
-		$date = date($this->getDatePattern());
84
-		$fileName = sprintf($fileName, $date);
77
+    /** 
78
+     * Similar to parent method, but but replaces "%s" in the file name with 
79
+     * the current date in format specified by the 'datePattern' parameter.
80
+     */ 
81
+    public function activateOptions() {
82
+        $fileName = $this->getFile();
83
+        $date = date($this->getDatePattern());
84
+        $fileName = sprintf($fileName, $date);
85 85
 		
86
-		if(!is_file($fileName)) {
87
-			$dir = dirname($fileName);
88
-			if(!is_dir($dir)) {
89
-				mkdir($dir, 0777, true);
90
-			}
91
-		}
86
+        if(!is_file($fileName)) {
87
+            $dir = dirname($fileName);
88
+            if(!is_dir($dir)) {
89
+                mkdir($dir, 0777, true);
90
+            }
91
+        }
92 92
 	
93
-		$this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
94
-		if($this->fp) {
95
-			if(flock($this->fp, LOCK_EX)) {
96
-				if($this->getAppend()) {
97
-					fseek($this->fp, 0, SEEK_END);
98
-				}
99
-				fwrite($this->fp, $this->layout->getHeader());
100
-				flock($this->fp, LOCK_UN);
101
-				$this->closed = false;
102
-			} else {
103
-				// TODO: should we take some action in this case?
104
-				$this->closed = true;
105
-			}
106
-		} else {
107
-			$this->closed = true;
108
-		}
109
-	}
93
+        $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
94
+        if($this->fp) {
95
+            if(flock($this->fp, LOCK_EX)) {
96
+                if($this->getAppend()) {
97
+                    fseek($this->fp, 0, SEEK_END);
98
+                }
99
+                fwrite($this->fp, $this->layout->getHeader());
100
+                flock($this->fp, LOCK_UN);
101
+                $this->closed = false;
102
+            } else {
103
+                // TODO: should we take some action in this case?
104
+                $this->closed = true;
105
+            }
106
+        } else {
107
+            $this->closed = true;
108
+        }
109
+    }
110 110
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterLevel.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
  */
27 27
 class Payone_Log4php_LoggerPatternConverterLevel extends Payone_Log4php_LoggerPatternConverter {
28 28
 
29
-	public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
30
-		return $event->getLevel()->toString();
31
-	}
29
+    public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
30
+        return $event->getLevel()->toString();
31
+    }
32 32
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterRequest.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,5 +29,5 @@
 block discarded – undo
29 29
  * @subpackage pattern
30 30
  */
31 31
 class Payone_Log4php_LoggerPatternConverterRequest extends Payone_Log4php_LoggerPatternConverterSuperglobal {
32
-	protected $name = '_REQUEST';
32
+    protected $name = '_REQUEST';
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.