Completed
Push — master ( e92961...2a4a7d )
by Florian
05:04
created
lib/Payone/Log4php/LoggerRendererObject.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@
 block discarded – undo
37 37
  * @since 0.3
38 38
  */
39 39
 interface Payone_Log4php_LoggerRendererObject {
40
-	/**
41
-	 * Render the entity passed as parameter as a String.
42
-	 * @param mixed $o entity to render
43
-	 * @return string
44
-	 */
45
-	public function render($o);
40
+    /**
41
+     * Render the entity passed as parameter as a String.
42
+     * @param mixed $o entity to render
43
+     * @return string
44
+     */
45
+    public function render($o);
46 46
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderPool.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,69 +31,69 @@
 block discarded – undo
31 31
  */
32 32
 class Payone_Log4php_LoggerAppenderPool {
33 33
 	
34
-	/** Holds appenders indexed by their name */
35
-	public static $appenders =  array();
34
+    /** Holds appenders indexed by their name */
35
+    public static $appenders =  array();
36 36
 
37
-	/**
38
-	 * Adds an appender to the pool. 
39
-	 * The appender must be named for this operation. 
40
-	 * @param Payone_Log4php_LoggerAppender $appender
41
-	 */
42
-	public static function add(Payone_Log4php_LoggerAppender $appender)
43
-	{
44
-		$name = $appender->getName();
37
+    /**
38
+     * Adds an appender to the pool. 
39
+     * The appender must be named for this operation. 
40
+     * @param Payone_Log4php_LoggerAppender $appender
41
+     */
42
+    public static function add(Payone_Log4php_LoggerAppender $appender)
43
+    {
44
+        $name = $appender->getName();
45 45
 		
46
-		if(empty($name)) {
47
-			trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
48
-			return;
49
-		}
46
+        if(empty($name)) {
47
+            trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
48
+            return;
49
+        }
50 50
 		
51
-		if (isset(self::$appenders[$name])) {
52
-			trigger_error("log4php: Appender [$name] already exists in pool. Overwriting existing appender.", E_USER_WARNING);
53
-		}
51
+        if (isset(self::$appenders[$name])) {
52
+            trigger_error("log4php: Appender [$name] already exists in pool. Overwriting existing appender.", E_USER_WARNING);
53
+        }
54 54
 		
55
-		self::$appenders[$name] = $appender;
56
-	}
55
+        self::$appenders[$name] = $appender;
56
+    }
57 57
 	
58
-	/** 
59
-	 * Retrieves an appender from the pool by name. 
60
-	 * @param string $name Name of the appender to retrieve.
61
-	 * @return Payone_Log4php_LoggerAppender The named appender or NULL if no such appender
62
-	 *  exists in the pool.
63
-	 */
64
-	public static function get($name) {
65
-		return isset(self::$appenders[$name]) ? self::$appenders[$name] : null;
66
-	}
58
+    /** 
59
+     * Retrieves an appender from the pool by name. 
60
+     * @param string $name Name of the appender to retrieve.
61
+     * @return Payone_Log4php_LoggerAppender The named appender or NULL if no such appender
62
+     *  exists in the pool.
63
+     */
64
+    public static function get($name) {
65
+        return isset(self::$appenders[$name]) ? self::$appenders[$name] : null;
66
+    }
67 67
 	
68
-	/**
69
-	* Removes an appender from the pool by name.
70
-	* @param string $name Name of the appender to remove.
71
-	*/
72
-	public static function delete($name) {
73
-		unset(self::$appenders[$name]);
74
-	}
68
+    /**
69
+     * Removes an appender from the pool by name.
70
+     * @param string $name Name of the appender to remove.
71
+     */
72
+    public static function delete($name) {
73
+        unset(self::$appenders[$name]);
74
+    }
75 75
 	
76
-	/**
77
-	 * Returns all appenders from the pool.
78
-	 * @return array Array of Payone_Log4php_LoggerAppender objects.
79
-	 */
80
-	public static function getAppenders() {
81
-		return self::$appenders;
82
-	}
76
+    /**
77
+     * Returns all appenders from the pool.
78
+     * @return array Array of Payone_Log4php_LoggerAppender objects.
79
+     */
80
+    public static function getAppenders() {
81
+        return self::$appenders;
82
+    }
83 83
 	
84
-	/**
85
-	 * Checks whether an appender exists in the pool.
86
-	 * @param string $name Name of the appender to look for.
87
-	 * @return boolean TRUE if the appender with the given name exists.
88
-	 */
89
-	public static function exists($name) {
90
-		return isset(self::$appenders[$name]);
91
-	}
84
+    /**
85
+     * Checks whether an appender exists in the pool.
86
+     * @param string $name Name of the appender to look for.
87
+     * @return boolean TRUE if the appender with the given name exists.
88
+     */
89
+    public static function exists($name) {
90
+        return isset(self::$appenders[$name]);
91
+    }
92 92
 
93
-	/**
94
-	 * Clears all appenders from the pool.
95
-	 */
96
-	public static function clear() {
97
-		 self::$appenders =  array();
98
-	}
93
+    /**
94
+     * Clears all appenders from the pool.
95
+     */
96
+    public static function clear() {
97
+            self::$appenders =  array();
98
+    }
99 99
 }
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 class Payone_Log4php_LoggerAppenderPool {
33 33
 	
34 34
 	/** Holds appenders indexed by their name */
35
-	public static $appenders =  array();
35
+	public static $appenders = array();
36 36
 
37 37
 	/**
38 38
 	 * Adds an appender to the pool. 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	{
44 44
 		$name = $appender->getName();
45 45
 		
46
-		if(empty($name)) {
46
+		if (empty($name)) {
47 47
 			trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
48 48
 			return;
49 49
 		}
@@ -94,6 +94,6 @@  discard block
 block discarded – undo
94 94
 	 * Clears all appenders from the pool.
95 95
 	 */
96 96
 	public static function clear() {
97
-		 self::$appenders =  array();
97
+		 self::$appenders = array();
98 98
 	}
99 99
 }
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderMailEvent.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -53,99 +53,99 @@
 block discarded – undo
53 53
  */
54 54
 class Payone_Log4php_LoggerAppenderMailEvent extends Payone_Log4php_LoggerAppender {
55 55
 
56
-	/**  'from' field (defaults to 'sendmail_from' from php.ini on win32).
57
-	 * @var string
58
-	 */
59
-	protected $from;
56
+    /**  'from' field (defaults to 'sendmail_from' from php.ini on win32).
57
+     * @var string
58
+     */
59
+    protected $from;
60 60
 
61
-	/** Mailserver port (win32 only).
62
-	 * @var integer 
63
-	 */
64
-	protected $port = 25;
61
+    /** Mailserver port (win32 only).
62
+     * @var integer 
63
+     */
64
+    protected $port = 25;
65 65
 
66
-	/** Mailserver hostname (win32 only).
67
-	 * @var string   
68
-	 */
69
-	protected $smtpHost = null;
66
+    /** Mailserver hostname (win32 only).
67
+     * @var string   
68
+     */
69
+    protected $smtpHost = null;
70 70
 
71
-	/**
72
-	 * @var string 'subject' field
73
-	 */
74
-	protected $subject = '';
71
+    /**
72
+     * @var string 'subject' field
73
+     */
74
+    protected $subject = '';
75 75
 
76
-	/**
77
-	 * @var string 'to' field
78
-	 */
79
-	protected $to = null;
76
+    /**
77
+     * @var string 'to' field
78
+     */
79
+    protected $to = null;
80 80
 	
81
-	/** @var indiciates if this appender should run in dry mode */
82
-	protected $dry = false;
81
+    /** @var indiciates if this appender should run in dry mode */
82
+    protected $dry = false;
83 83
 	
84
-	public function activateOptions() {
85
-		if (empty($this->to)) {
86
-			$this->warn("Required parameter 'to' not set. Closing appender.");
87
-			$this->close = true;
88
-			return;
89
-		}
84
+    public function activateOptions() {
85
+        if (empty($this->to)) {
86
+            $this->warn("Required parameter 'to' not set. Closing appender.");
87
+            $this->close = true;
88
+            return;
89
+        }
90 90
 		
91
-		$sendmail_from = ini_get('sendmail_from');
92
-		if (empty($this->from) and empty($sendmail_from)) {
93
-			$this->warn("Required parameter 'from' not set. Closing appender.");
94
-			$this->close = true;
95
-			return;
96
-		}
91
+        $sendmail_from = ini_get('sendmail_from');
92
+        if (empty($this->from) and empty($sendmail_from)) {
93
+            $this->warn("Required parameter 'from' not set. Closing appender.");
94
+            $this->close = true;
95
+            return;
96
+        }
97 97
 		
98
-		$this->closed = false;
99
-	}
98
+        $this->closed = false;
99
+    }
100 100
 	
101
-	public function setFrom($from) {
102
-		$this->setString('from', $from);
103
-	}
101
+    public function setFrom($from) {
102
+        $this->setString('from', $from);
103
+    }
104 104
 	
105
-	public function setPort($port) {
106
-		$this->setPositiveInteger('port', $port);
107
-	}
105
+    public function setPort($port) {
106
+        $this->setPositiveInteger('port', $port);
107
+    }
108 108
 	
109
-	public function setSmtpHost($smtpHost) {
110
-		$this->setString('smtpHost', $smtpHost);
111
-	}
109
+    public function setSmtpHost($smtpHost) {
110
+        $this->setString('smtpHost', $smtpHost);
111
+    }
112 112
 	
113
-	public function setSubject($subject) {
114
-		$this->setString('subject',  $subject);
115
-	}
113
+    public function setSubject($subject) {
114
+        $this->setString('subject',  $subject);
115
+    }
116 116
 	
117
-	public function setTo($to) {
118
-		$this->setString('to',  $to);
119
-	}
117
+    public function setTo($to) {
118
+        $this->setString('to',  $to);
119
+    }
120 120
 
121
-	public function setDry($dry) {
122
-		$this->setBoolean('dry', $dry);
123
-	}
121
+    public function setDry($dry) {
122
+        $this->setBoolean('dry', $dry);
123
+    }
124 124
 	
125
-	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
126
-		$smtpHost = $this->smtpHost;
127
-		$prevSmtpHost = ini_get('SMTP');
128
-		if(!empty($smtpHost)) {
129
-			ini_set('SMTP', $smtpHost);
130
-		} 
125
+    public function append(Payone_Log4php_LoggerLoggingEvent $event) {
126
+        $smtpHost = $this->smtpHost;
127
+        $prevSmtpHost = ini_get('SMTP');
128
+        if(!empty($smtpHost)) {
129
+            ini_set('SMTP', $smtpHost);
130
+        } 
131 131
 
132
-		$smtpPort = $this->port;
133
-		$prevSmtpPort= ini_get('smtp_port');		
134
-		if($smtpPort > 0 and $smtpPort < 65535) {
135
-			ini_set('smtp_port', $smtpPort);
136
-		}
132
+        $smtpPort = $this->port;
133
+        $prevSmtpPort= ini_get('smtp_port');		
134
+        if($smtpPort > 0 and $smtpPort < 65535) {
135
+            ini_set('smtp_port', $smtpPort);
136
+        }
137 137
 
138
-		// On unix only sendmail_path, which is PHP_INI_SYSTEM i.e. not changeable here, is used.
138
+        // On unix only sendmail_path, which is PHP_INI_SYSTEM i.e. not changeable here, is used.
139 139
 
140
-		$addHeader = empty($this->from) ? '' : "From: {$this->from}\r\n";
140
+        $addHeader = empty($this->from) ? '' : "From: {$this->from}\r\n";
141 141
 		
142
-		if(!$this->dry) {
143
-			$result = mail($this->to, $this->subject, $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), $addHeader);			
144
-		} else {
145
-			echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
146
-		}
142
+        if(!$this->dry) {
143
+            $result = mail($this->to, $this->subject, $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), $addHeader);			
144
+        } else {
145
+            echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
146
+        }
147 147
 			
148
-		ini_set('SMTP', $prevSmtpHost);
149
-		ini_set('smtp_port', $prevSmtpPort);
150
-	}
148
+        ini_set('SMTP', $prevSmtpHost);
149
+        ini_set('smtp_port', $prevSmtpPort);
150
+    }
151 151
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 	
113 113
 	public function setSubject($subject) {
114
-		$this->setString('subject',  $subject);
114
+		$this->setString('subject', $subject);
115 115
 	}
116 116
 	
117 117
 	public function setTo($to) {
118
-		$this->setString('to',  $to);
118
+		$this->setString('to', $to);
119 119
 	}
120 120
 
121 121
 	public function setDry($dry) {
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
126 126
 		$smtpHost = $this->smtpHost;
127 127
 		$prevSmtpHost = ini_get('SMTP');
128
-		if(!empty($smtpHost)) {
128
+		if (!empty($smtpHost)) {
129 129
 			ini_set('SMTP', $smtpHost);
130 130
 		} 
131 131
 
132 132
 		$smtpPort = $this->port;
133
-		$prevSmtpPort= ini_get('smtp_port');		
134
-		if($smtpPort > 0 and $smtpPort < 65535) {
133
+		$prevSmtpPort = ini_get('smtp_port');		
134
+		if ($smtpPort > 0 and $smtpPort < 65535) {
135 135
 			ini_set('smtp_port', $smtpPort);
136 136
 		}
137 137
 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$addHeader = empty($this->from) ? '' : "From: {$this->from}\r\n";
141 141
 		
142
-		if(!$this->dry) {
142
+		if (!$this->dry) {
143 143
 			$result = mail($this->to, $this->subject, $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), $addHeader);			
144 144
 		} else {
145
-			echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
145
+			echo "DRY MODE OF MAIL APP.: Send mail to: " . $this->to . " with additional headers '" . trim($addHeader) . "' and content: " . $this->layout->format($event);
146 146
 		}
147 147
 			
148 148
 		ini_set('SMTP', $prevSmtpHost);
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterServer.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_LoggerPatternConverterServer extends Payone_Log4php_LoggerPatternConverterSuperglobal {
32
-	protected $name = '_SERVER';
32
+    protected $name = '_SERVER';
33 33
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterSessionID.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
  * @subpackage pattern
26 26
  */
27 27
 class Payone_Log4php_LoggerPatternConverterSessionID extends Payone_Log4php_LoggerPatternConverter {
28
-	public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
29
-		return session_id();
30
-	}
28
+    public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
29
+        return session_id();
30
+    }
31 31
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerOptionConverter.php 2 patches
Indentation   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -28,424 +28,424 @@
 block discarded – undo
28 28
  */
29 29
 class Payone_Log4php_LoggerOptionConverter {
30 30
 
31
-	const DELIM_START = '${';
32
-	const DELIM_STOP = '}';
33
-	const DELIM_START_LEN = 2;
34
-	const DELIM_STOP_LEN = 1;
31
+    const DELIM_START = '${';
32
+    const DELIM_STOP = '}';
33
+    const DELIM_START_LEN = 2;
34
+    const DELIM_STOP_LEN = 1;
35 35
 	
36
-	/** String values which are converted to boolean TRUE. */
37
-	private static $trueValues = array('1', 'true', 'yes', 'on');
36
+    /** String values which are converted to boolean TRUE. */
37
+    private static $trueValues = array('1', 'true', 'yes', 'on');
38 38
 	
39
-	/** 
40
-	 * String values which are converted to boolean FALSE.
41
-	 * 
42
-	 * Note that an empty string must convert to false, because 
43
-	 * parse_ini_file() which is used for parsing configuration 
44
-	 * converts the value _false_ to an empty string.
45
-	 */
46
-	private static $falseValues = array('0', 'false', 'no', 'off', '');
39
+    /** 
40
+     * String values which are converted to boolean FALSE.
41
+     * 
42
+     * Note that an empty string must convert to false, because 
43
+     * parse_ini_file() which is used for parsing configuration 
44
+     * converts the value _false_ to an empty string.
45
+     */
46
+    private static $falseValues = array('0', 'false', 'no', 'off', '');
47 47
 	
48
-	/**
49
-	 * Read a predefined var.
50
-	 *
51
-	 * It returns a value referenced by <var>$key</var> using this search criteria:
52
-	 * - if <var>$key</var> is a constant then return it. Else
53
-	 * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
54
-	 * - return <var>$def</var>. 
55
-	 *
56
-	 * @param string $key The key to search for.
57
-	 * @param string $def The default value to return.
58
-	 * @return string	the string value of the system property, or the default
59
-	 *					value if there is no property with that key.
60
-	 */
61
-	public static function getSystemProperty($key, $def) {
62
-		if(defined($key)) {
63
-			return (string)constant($key);
64
-		} else if(isset($_SERVER[$key])) {
65
-			return (string)$_SERVER[$key];
66
-		} else if(isset($_ENV[$key])) {
67
-			return (string)$_ENV[$key];
68
-		} else {
69
-			return $def;
70
-		}
71
-	}
48
+    /**
49
+     * Read a predefined var.
50
+     *
51
+     * It returns a value referenced by <var>$key</var> using this search criteria:
52
+     * - if <var>$key</var> is a constant then return it. Else
53
+     * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
54
+     * - return <var>$def</var>. 
55
+     *
56
+     * @param string $key The key to search for.
57
+     * @param string $def The default value to return.
58
+     * @return string	the string value of the system property, or the default
59
+     *					value if there is no property with that key.
60
+     */
61
+    public static function getSystemProperty($key, $def) {
62
+        if(defined($key)) {
63
+            return (string)constant($key);
64
+        } else if(isset($_SERVER[$key])) {
65
+            return (string)$_SERVER[$key];
66
+        } else if(isset($_ENV[$key])) {
67
+            return (string)$_ENV[$key];
68
+        } else {
69
+            return $def;
70
+        }
71
+    }
72 72
 
73
-	/**
74
-	 * If <var>$value</var> is <i>true</i>, then <i>true</i> is
75
-	 * returned. If <var>$value</var> is <i>false</i>, then
76
-	 * <i>true</i> is returned. Otherwise, <var>$default</var> is
77
-	 * returned.
78
-	 *
79
-	 * <p>Case of value is unimportant.</p>
80
-	 *
81
-	 * @param string $value
82
-	 * @param boolean $default
83
-	 * @return boolean
84
-	 */
85
-	public static function toBoolean($value, $default=true) {
86
-		if (is_null($value)) {
87
-			return $default;
88
-		} elseif (is_string($value)) {
89
-			$trimmedVal = strtolower(trim($value));
90
-			if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
91
-				return true;
92
-			} else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
93
-				return false;
94
-			}
95
-		} elseif (is_bool($value)) {
96
-			return $value;
97
-		} elseif (is_int($value)) {
98
-			return !($value == 0); // true is everything but 0 like in C 
99
-		}
73
+    /**
74
+     * If <var>$value</var> is <i>true</i>, then <i>true</i> is
75
+     * returned. If <var>$value</var> is <i>false</i>, then
76
+     * <i>true</i> is returned. Otherwise, <var>$default</var> is
77
+     * returned.
78
+     *
79
+     * <p>Case of value is unimportant.</p>
80
+     *
81
+     * @param string $value
82
+     * @param boolean $default
83
+     * @return boolean
84
+     */
85
+    public static function toBoolean($value, $default=true) {
86
+        if (is_null($value)) {
87
+            return $default;
88
+        } elseif (is_string($value)) {
89
+            $trimmedVal = strtolower(trim($value));
90
+            if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
91
+                return true;
92
+            } else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
93
+                return false;
94
+            }
95
+        } elseif (is_bool($value)) {
96
+            return $value;
97
+        } elseif (is_int($value)) {
98
+            return !($value == 0); // true is everything but 0 like in C 
99
+        }
100 100
 		
101
-		return $default;
102
-	}
101
+        return $default;
102
+    }
103 103
 
104
-	/** Converts $value to boolean, or throws an exception if not possible. */
105
-	public static function toBooleanEx($value) {
106
-		if (isset($value)) {
107
-			if (is_bool($value)) {
108
-				return $value;
109
-			}
110
-			$value = strtolower(trim($value));
111
-			if (in_array($value, self::$trueValues)) {
112
-				return true;
113
-			}
114
-			if (in_array($value, self::$falseValues)) {
115
-				return false;
116
-			}
117
-		}
104
+    /** Converts $value to boolean, or throws an exception if not possible. */
105
+    public static function toBooleanEx($value) {
106
+        if (isset($value)) {
107
+            if (is_bool($value)) {
108
+                return $value;
109
+            }
110
+            $value = strtolower(trim($value));
111
+            if (in_array($value, self::$trueValues)) {
112
+                return true;
113
+            }
114
+            if (in_array($value, self::$falseValues)) {
115
+                return false;
116
+            }
117
+        }
118 118
 		
119
-		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to boolean.");
120
-	}
119
+        throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to boolean.");
120
+    }
121 121
 	
122
-	/**
123
-	 * @param string $value
124
-	 * @param integer $default
125
-	 * @return integer
126
-	 */
127
-	public static function toInt($value, $default) {
128
-		$value = trim($value);
129
-		if(is_numeric($value)) {
130
-			return (int)$value;
131
-		} else {
132
-			return $default;
133
-		}
134
-	}
122
+    /**
123
+     * @param string $value
124
+     * @param integer $default
125
+     * @return integer
126
+     */
127
+    public static function toInt($value, $default) {
128
+        $value = trim($value);
129
+        if(is_numeric($value)) {
130
+            return (int)$value;
131
+        } else {
132
+            return $default;
133
+        }
134
+    }
135 135
 	
136 136
 	
137
-	/** 
138
-	 * Converts $value to integer, or throws an exception if not possible. 
139
-	 * Floats cannot be converted to integer.
140
-	 */
141
-	public static function toIntegerEx($value) {
142
-		if (is_integer($value)) {
143
-			return $value;
144
-		}
145
-		if (is_numeric($value) && ($value == (integer) $value)) {
146
-			return (integer) $value;
147
-		}
137
+    /** 
138
+     * Converts $value to integer, or throws an exception if not possible. 
139
+     * Floats cannot be converted to integer.
140
+     */
141
+    public static function toIntegerEx($value) {
142
+        if (is_integer($value)) {
143
+            return $value;
144
+        }
145
+        if (is_numeric($value) && ($value == (integer) $value)) {
146
+            return (integer) $value;
147
+        }
148 148
 	
149
-		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to integer.");
150
-	}
149
+        throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to integer.");
150
+    }
151 151
 	
152
-	/**
153
-	 * Converts $value to integer, or throws an exception if not possible.
154
-	 * Floats cannot be converted to integer.
155
-	 */
156
-	public static function toPositiveIntegerEx($value) {
157
-		if (is_integer($value) && $value > 0) {
158
-			return $value;
159
-		}
160
-		if (is_numeric($value) && ($value == (integer) $value) && $value > 0) {
161
-			return (integer) $value;
162
-		}
152
+    /**
153
+     * Converts $value to integer, or throws an exception if not possible.
154
+     * Floats cannot be converted to integer.
155
+     */
156
+    public static function toPositiveIntegerEx($value) {
157
+        if (is_integer($value) && $value > 0) {
158
+            return $value;
159
+        }
160
+        if (is_numeric($value) && ($value == (integer) $value) && $value > 0) {
161
+            return (integer) $value;
162
+        }
163 163
 	
164
-		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a positive integer.");
165
-	}
164
+        throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a positive integer.");
165
+    }
166 166
 
167
-	/**
168
-	 * Converts a standard or custom priority level to a Level
169
-	 * object.
170
-	 *
171
-	 * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
172
-	 * where <i>full_file_classname</i> means the class filename with path
173
-	 * but without php extension, then the specified class' <i>toLevel()</i> method
174
-	 * is called to process the specified level string; if no '#'
175
-	 * character is present, then the default {@link LoggerLevel}
176
-	 * class is used to process the level value.</p>
177
-	 *
178
-	 * <p>As a special case, if the <var>$value</var> parameter is
179
-	 * equal to the string "NULL", then the value <i>null</i> will
180
-	 * be returned.</p>
181
-	 *
182
-	 * <p>If any error occurs while converting the value to a level,
183
-	 * the <var>$defaultValue</var> parameter, which may be
184
-	 * <i>null</i>, is returned.</p>
185
-	 *
186
-	 * <p>Case of <var>$value</var> is insignificant for the level level, but is
187
-	 * significant for the class name part, if present.</p>
188
-	 *
189
-	 * @param string $value
190
-	 * @param Payone_Log4php_LoggerLevel $defaultValue
191
-	 * @return Payone_Log4php_LoggerLevel a {@link LoggerLevel} or null
192
-	 */
193
-	public static function toLevel($value, $defaultValue) {
194
-		if($value === null) {
195
-			return $defaultValue;
196
-		}
197
-		$hashIndex = strpos($value, '#');
198
-		if($hashIndex === false) {
199
-			if("NULL" == strtoupper($value)) {
200
-				return null;
201
-			} else {
202
-				// no class name specified : use standard Level class
203
-				return Payone_Log4php_LoggerLevel::toLevel($value, $defaultValue);
204
-			}
205
-		}
167
+    /**
168
+     * Converts a standard or custom priority level to a Level
169
+     * object.
170
+     *
171
+     * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
172
+     * where <i>full_file_classname</i> means the class filename with path
173
+     * but without php extension, then the specified class' <i>toLevel()</i> method
174
+     * is called to process the specified level string; if no '#'
175
+     * character is present, then the default {@link LoggerLevel}
176
+     * class is used to process the level value.</p>
177
+     *
178
+     * <p>As a special case, if the <var>$value</var> parameter is
179
+     * equal to the string "NULL", then the value <i>null</i> will
180
+     * be returned.</p>
181
+     *
182
+     * <p>If any error occurs while converting the value to a level,
183
+     * the <var>$defaultValue</var> parameter, which may be
184
+     * <i>null</i>, is returned.</p>
185
+     *
186
+     * <p>Case of <var>$value</var> is insignificant for the level level, but is
187
+     * significant for the class name part, if present.</p>
188
+     *
189
+     * @param string $value
190
+     * @param Payone_Log4php_LoggerLevel $defaultValue
191
+     * @return Payone_Log4php_LoggerLevel a {@link LoggerLevel} or null
192
+     */
193
+    public static function toLevel($value, $defaultValue) {
194
+        if($value === null) {
195
+            return $defaultValue;
196
+        }
197
+        $hashIndex = strpos($value, '#');
198
+        if($hashIndex === false) {
199
+            if("NULL" == strtoupper($value)) {
200
+                return null;
201
+            } else {
202
+                // no class name specified : use standard Level class
203
+                return Payone_Log4php_LoggerLevel::toLevel($value, $defaultValue);
204
+            }
205
+        }
206 206
 
207
-		$result = $defaultValue;
207
+        $result = $defaultValue;
208 208
 
209
-		$clazz = substr($value, ($hashIndex + 1));
210
-		$levelName = substr($value, 0, $hashIndex);
209
+        $clazz = substr($value, ($hashIndex + 1));
210
+        $levelName = substr($value, 0, $hashIndex);
211 211
 
212
-		// This is degenerate case but you never know.
213
-		if("NULL" == strtoupper($levelName)) {
214
-			return null;
215
-		}
212
+        // This is degenerate case but you never know.
213
+        if("NULL" == strtoupper($levelName)) {
214
+            return null;
215
+        }
216 216
 
217
-		$clazz = basename($clazz);
217
+        $clazz = basename($clazz);
218 218
 
219
-		if(class_exists($clazz)) {
220
-			$result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
221
-			if(!$result instanceof Payone_Log4php_LoggerLevel) {
222
-				$result = $defaultValue;
223
-			}
224
-		} 
225
-		return $result;
226
-	}
219
+        if(class_exists($clazz)) {
220
+            $result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
221
+            if(!$result instanceof Payone_Log4php_LoggerLevel) {
222
+                $result = $defaultValue;
223
+            }
224
+        } 
225
+        return $result;
226
+    }
227 227
 	
228 228
 	
229
-	/** Converts the value to a level. Throws an exception if not possible. */
230
-	public static function toLevelEx($value) {
231
-		if ($value instanceof Payone_Log4php_LoggerLevel) {
232
-			return $value;
233
-		}
234
-		$level = Payone_Log4php_LoggerLevel::toLevel($value);
235
-		if ($level === null) {
236
-			throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a logger level.");
237
-		}
238
-		return $level;
239
-	}
229
+    /** Converts the value to a level. Throws an exception if not possible. */
230
+    public static function toLevelEx($value) {
231
+        if ($value instanceof Payone_Log4php_LoggerLevel) {
232
+            return $value;
233
+        }
234
+        $level = Payone_Log4php_LoggerLevel::toLevel($value);
235
+        if ($level === null) {
236
+            throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a logger level.");
237
+        }
238
+        return $level;
239
+    }
240 240
 
241
-	/**
242
-	 * @param string $value
243
-	 * @param float $default
244
-	 * @return float
245
-	 */
246
-	public static function toFileSize($value, $default) {
247
-		if($value === null) {
248
-			return $default;
249
-		}
241
+    /**
242
+     * @param string $value
243
+     * @param float $default
244
+     * @return float
245
+     */
246
+    public static function toFileSize($value, $default) {
247
+        if($value === null) {
248
+            return $default;
249
+        }
250 250
 
251
-		$s = strtoupper(trim($value));
252
-		$multiplier = (float)1;
253
-		if(($index = strpos($s, 'KB')) !== false) {
254
-			$multiplier = 1024;
255
-			$s = substr($s, 0, $index);
256
-		} else if(($index = strpos($s, 'MB')) !== false) {
257
-			$multiplier = 1024 * 1024;
258
-			$s = substr($s, 0, $index);
259
-		} else if(($index = strpos($s, 'GB')) !== false) {
260
-			$multiplier = 1024 * 1024 * 1024;
261
-			$s = substr($s, 0, $index);
262
-		}
263
-		if(is_numeric($s)) {
264
-			return (float)$s * $multiplier;
265
-		} 
266
-		return $default;
267
-	}
251
+        $s = strtoupper(trim($value));
252
+        $multiplier = (float)1;
253
+        if(($index = strpos($s, 'KB')) !== false) {
254
+            $multiplier = 1024;
255
+            $s = substr($s, 0, $index);
256
+        } else if(($index = strpos($s, 'MB')) !== false) {
257
+            $multiplier = 1024 * 1024;
258
+            $s = substr($s, 0, $index);
259
+        } else if(($index = strpos($s, 'GB')) !== false) {
260
+            $multiplier = 1024 * 1024 * 1024;
261
+            $s = substr($s, 0, $index);
262
+        }
263
+        if(is_numeric($s)) {
264
+            return (float)$s * $multiplier;
265
+        } 
266
+        return $default;
267
+    }
268 268
 	
269 269
 
270
-	/**
271
-	 * Converts a value to a valid file size (integer).
272
-	 * 
273
-	 * Supports 'KB', 'MB' and 'GB' suffixes, where KB = 1024 B etc. 
274
-	 *
275
-	 * The final value will be rounded to the nearest integer.
276
-	 *
277
-	 * Examples:
278
-	 * - '100' => 100
279
-	 * - '100.12' => 100
280
-	 * - '100KB' => 102400
281
-	 * - '1.5MB' => 1572864
282
-	 * 
283
-	 * @param mixed $value File size (optionally with suffix).
284
-	 * @return integer Parsed file size.
285
-	 */
286
-	public static function toFileSizeEx($value) {
270
+    /**
271
+     * Converts a value to a valid file size (integer).
272
+     * 
273
+     * Supports 'KB', 'MB' and 'GB' suffixes, where KB = 1024 B etc. 
274
+     *
275
+     * The final value will be rounded to the nearest integer.
276
+     *
277
+     * Examples:
278
+     * - '100' => 100
279
+     * - '100.12' => 100
280
+     * - '100KB' => 102400
281
+     * - '1.5MB' => 1572864
282
+     * 
283
+     * @param mixed $value File size (optionally with suffix).
284
+     * @return integer Parsed file size.
285
+     */
286
+    public static function toFileSizeEx($value) {
287 287
 		
288
-		if (empty($value)) {
289
-			throw new Payone_Log4php_LoggerException("Empty value cannot be converted to a file size.");
290
-		}
288
+        if (empty($value)) {
289
+            throw new Payone_Log4php_LoggerException("Empty value cannot be converted to a file size.");
290
+        }
291 291
 		
292
-		if (is_numeric($value)) {
293
-			return (integer) $value;
294
-		}
292
+        if (is_numeric($value)) {
293
+            return (integer) $value;
294
+        }
295 295
 		
296
-		if (!is_string($value)) {
297
-			throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a file size.");
298
-		}
296
+        if (!is_string($value)) {
297
+            throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a file size.");
298
+        }
299 299
 		
300
-		$str = strtoupper(trim($value));
301
-		$count = preg_match('/^([0-9.]+)(KB|MB|GB)?$/', $str, $matches);
300
+        $str = strtoupper(trim($value));
301
+        $count = preg_match('/^([0-9.]+)(KB|MB|GB)?$/', $str, $matches);
302 302
 		
303
-		if ($count > 0) {
304
-			$size = $matches[1];
305
-			$unit = $matches[2];
303
+        if ($count > 0) {
304
+            $size = $matches[1];
305
+            $unit = $matches[2];
306 306
 			
307
-			switch($unit) {
308
-				case 'KB': $size *= pow(1024, 1); break;
309
-				case 'MB': $size *= pow(1024, 2); break;
310
-				case 'GB': $size *= pow(1024, 3); break;
311
-			}
307
+            switch($unit) {
308
+                case 'KB': $size *= pow(1024, 1); break;
309
+                case 'MB': $size *= pow(1024, 2); break;
310
+                case 'GB': $size *= pow(1024, 3); break;
311
+            }
312 312
 			
313
-			return (integer) $size;
314
-		}
313
+            return (integer) $size;
314
+        }
315 315
 		
316
-		throw new Payone_Log4php_LoggerException("Given value [$value] cannot be converted to a file size.");
317
-	}
316
+        throw new Payone_Log4php_LoggerException("Given value [$value] cannot be converted to a file size.");
317
+    }
318 318
 
319
-	/** 
320
-	 * Converts a value to string, or throws an exception if not possible. 
321
-	 * 
322
-	 * Objects can be converted to string if they implement the magic 
323
-	 * __toString() method.
324
-	 * 
325
-	 */
326
-	public static function toStringEx($value) {
327
-		if (is_string($value)) {
328
-			return $value;
329
-		}
330
-		if (is_numeric($value)) {
331
-			return (string) $value;
332
-		}
333
-		if (is_object($value) && method_exists($value, '__toString')) {
334
-			return (string) $value;
335
-		}
319
+    /** 
320
+     * Converts a value to string, or throws an exception if not possible. 
321
+     * 
322
+     * Objects can be converted to string if they implement the magic 
323
+     * __toString() method.
324
+     * 
325
+     */
326
+    public static function toStringEx($value) {
327
+        if (is_string($value)) {
328
+            return $value;
329
+        }
330
+        if (is_numeric($value)) {
331
+            return (string) $value;
332
+        }
333
+        if (is_object($value) && method_exists($value, '__toString')) {
334
+            return (string) $value;
335
+        }
336 336
 	
337
-		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to string.");
338
-	}
337
+        throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to string.");
338
+    }
339 339
 	
340 340
 	
341
-	/**
342
-	 * Find the value corresponding to <var>$key</var> in
343
-	 * <var>$props</var>. Then perform variable substitution on the
344
-	 * found value.
345
-	 *
346
-	 * @param string $key
347
-	 * @param array $props
348
-	 * @return string
349
-	 */
350
-	public static function findAndSubst($key, $props) {
351
-		$value = @$props[$key];
341
+    /**
342
+     * Find the value corresponding to <var>$key</var> in
343
+     * <var>$props</var>. Then perform variable substitution on the
344
+     * found value.
345
+     *
346
+     * @param string $key
347
+     * @param array $props
348
+     * @return string
349
+     */
350
+    public static function findAndSubst($key, $props) {
351
+        $value = @$props[$key];
352 352
 
353
-		// If coming from the LoggerConfiguratorIni, some options were
354
-		// already mangled by parse_ini_file:
355
-		//
356
-		// not specified      => never reaches this code
357
-		// ""|off|false|null  => string(0) ""
358
-		// "1"|on|true        => string(1) "1"
359
-		// "true"             => string(4) "true"
360
-		// "false"            => string(5) "false"
361
-		// 
362
-		// As the integer 1 and the boolean true are therefore indistinguable
363
-		// it's up to the setter how to deal with it, they can not be cast
364
-		// into a boolean here. {@see toBoolean}
365
-		// Even an empty value has to be given to the setter as it has been
366
-		// explicitly set by the user and is different from an option which
367
-		// has not been specified and therefore keeps its default value.
368
-		//
369
-		// if(!empty($value)) {
370
-			return Payone_Log4php_LoggerOptionConverter::substVars($value, $props);
371
-		// }
372
-	}
353
+        // If coming from the LoggerConfiguratorIni, some options were
354
+        // already mangled by parse_ini_file:
355
+        //
356
+        // not specified      => never reaches this code
357
+        // ""|off|false|null  => string(0) ""
358
+        // "1"|on|true        => string(1) "1"
359
+        // "true"             => string(4) "true"
360
+        // "false"            => string(5) "false"
361
+        // 
362
+        // As the integer 1 and the boolean true are therefore indistinguable
363
+        // it's up to the setter how to deal with it, they can not be cast
364
+        // into a boolean here. {@see toBoolean}
365
+        // Even an empty value has to be given to the setter as it has been
366
+        // explicitly set by the user and is different from an option which
367
+        // has not been specified and therefore keeps its default value.
368
+        //
369
+        // if(!empty($value)) {
370
+            return Payone_Log4php_LoggerOptionConverter::substVars($value, $props);
371
+        // }
372
+    }
373 373
 
374
-	/**
375
-	 * Perform variable substitution in string <var>$val</var> from the
376
-	 * values of keys found with the {@link getSystemProperty()} method.
377
-	 * 
378
-	 * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
379
-	 * 
380
-	 * <p>For example, if the "MY_CONSTANT" contains "value", then
381
-	 * the call
382
-	 * <code>
383
-	 * $s = LoggerOptionConverter::substVars("Value of key is ${MY_CONSTANT}.");
384
-	 * </code>
385
-	 * will set the variable <i>$s</i> to "Value of key is value.".</p>
386
-	 * 
387
-	 * <p>If no value could be found for the specified key, then the
388
-	 * <var>$props</var> parameter is searched, if the value could not
389
-	 * be found there, then substitution defaults to the empty string.</p>
390
-	 * 
391
-	 * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
392
-	 * "inexistentKey", then the call
393
-	 * <code>
394
-	 * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
395
-	 * </code>
396
-	 * will set <var>$s</var> to "Value of inexistentKey is []".</p>
397
-	 * 
398
-	 * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
399
-	 * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
400
-	 * 
401
-	 * @param string $val The string on which variable substitution is performed.
402
-	 * @param array $props
403
-	 * @return string
404
-	 */
405
-	 // TODO: this method doesn't work correctly with key = true, it needs key = "true" which is odd
406
-	public static function substVars($val, $props = null) {
407
-		$sbuf = '';
408
-		$i = 0;
409
-		while(true) {
410
-			$j = strpos($val, self::DELIM_START, $i);
411
-			if($j === false) {
412
-				// no more variables
413
-				if($i == 0) { // this is a simple string
414
-					return $val;
415
-				} else { // add the tail string which contails no variables and return the result.
416
-					$sbuf .= substr($val, $i);
417
-					return $sbuf;
418
-				}
419
-			} else {
374
+    /**
375
+     * Perform variable substitution in string <var>$val</var> from the
376
+     * values of keys found with the {@link getSystemProperty()} method.
377
+     * 
378
+     * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
379
+     * 
380
+     * <p>For example, if the "MY_CONSTANT" contains "value", then
381
+     * the call
382
+     * <code>
383
+     * $s = LoggerOptionConverter::substVars("Value of key is ${MY_CONSTANT}.");
384
+     * </code>
385
+     * will set the variable <i>$s</i> to "Value of key is value.".</p>
386
+     * 
387
+     * <p>If no value could be found for the specified key, then the
388
+     * <var>$props</var> parameter is searched, if the value could not
389
+     * be found there, then substitution defaults to the empty string.</p>
390
+     * 
391
+     * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
392
+     * "inexistentKey", then the call
393
+     * <code>
394
+     * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
395
+     * </code>
396
+     * will set <var>$s</var> to "Value of inexistentKey is []".</p>
397
+     * 
398
+     * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
399
+     * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
400
+     * 
401
+     * @param string $val The string on which variable substitution is performed.
402
+     * @param array $props
403
+     * @return string
404
+     */
405
+        // TODO: this method doesn't work correctly with key = true, it needs key = "true" which is odd
406
+    public static function substVars($val, $props = null) {
407
+        $sbuf = '';
408
+        $i = 0;
409
+        while(true) {
410
+            $j = strpos($val, self::DELIM_START, $i);
411
+            if($j === false) {
412
+                // no more variables
413
+                if($i == 0) { // this is a simple string
414
+                    return $val;
415
+                } else { // add the tail string which contails no variables and return the result.
416
+                    $sbuf .= substr($val, $i);
417
+                    return $sbuf;
418
+                }
419
+            } else {
420 420
 			
421
-				$sbuf .= substr($val, $i, $j-$i);
422
-				$k = strpos($val, self::DELIM_STOP, $j);
423
-				if($k === false) {
424
-					// LoggerOptionConverter::substVars() has no closing brace. Opening brace
425
-					return '';
426
-				} else {
427
-					$j += self::DELIM_START_LEN;
428
-					$key = substr($val, $j, $k - $j);
429
-					// first try in System properties
430
-					$replacement = Payone_Log4php_LoggerOptionConverter::getSystemProperty($key, null);
431
-					// then try props parameter
432
-					if($replacement == null and $props !== null) {
433
-						$replacement = @$props[$key];
434
-					}
421
+                $sbuf .= substr($val, $i, $j-$i);
422
+                $k = strpos($val, self::DELIM_STOP, $j);
423
+                if($k === false) {
424
+                    // LoggerOptionConverter::substVars() has no closing brace. Opening brace
425
+                    return '';
426
+                } else {
427
+                    $j += self::DELIM_START_LEN;
428
+                    $key = substr($val, $j, $k - $j);
429
+                    // first try in System properties
430
+                    $replacement = Payone_Log4php_LoggerOptionConverter::getSystemProperty($key, null);
431
+                    // then try props parameter
432
+                    if($replacement == null and $props !== null) {
433
+                        $replacement = @$props[$key];
434
+                    }
435 435
 
436
-					if(!empty($replacement)) {
437
-						// Do variable substitution on the replacement string
438
-						// such that we can solve "Hello ${x2}" as "Hello p1" 
439
-						// the where the properties are
440
-						// x1=p1
441
-						// x2=${x1}
442
-						$recursiveReplacement = Payone_Log4php_LoggerOptionConverter::substVars($replacement, $props);
443
-						$sbuf .= $recursiveReplacement;
444
-					}
445
-					$i = $k + self::DELIM_STOP_LEN;
446
-				}
447
-			}
448
-		}
449
-	}
436
+                    if(!empty($replacement)) {
437
+                        // Do variable substitution on the replacement string
438
+                        // such that we can solve "Hello ${x2}" as "Hello p1" 
439
+                        // the where the properties are
440
+                        // x1=p1
441
+                        // x2=${x1}
442
+                        $recursiveReplacement = Payone_Log4php_LoggerOptionConverter::substVars($replacement, $props);
443
+                        $sbuf .= $recursiveReplacement;
444
+                    }
445
+                    $i = $k + self::DELIM_STOP_LEN;
446
+                }
447
+            }
448
+        }
449
+    }
450 450
 
451 451
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 	 *					value if there is no property with that key.
60 60
 	 */
61 61
 	public static function getSystemProperty($key, $def) {
62
-		if(defined($key)) {
62
+		if (defined($key)) {
63 63
 			return (string)constant($key);
64
-		} else if(isset($_SERVER[$key])) {
64
+		} else if (isset($_SERVER[$key])) {
65 65
 			return (string)$_SERVER[$key];
66
-		} else if(isset($_ENV[$key])) {
66
+		} else if (isset($_ENV[$key])) {
67 67
 			return (string)$_ENV[$key];
68 68
 		} else {
69 69
 			return $def;
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 	 * @param boolean $default
83 83
 	 * @return boolean
84 84
 	 */
85
-	public static function toBoolean($value, $default=true) {
85
+	public static function toBoolean($value, $default = true) {
86 86
 		if (is_null($value)) {
87 87
 			return $default;
88 88
 		} elseif (is_string($value)) {
89 89
 			$trimmedVal = strtolower(trim($value));
90
-			if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
90
+			if ("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
91 91
 				return true;
92 92
 			} else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
93 93
 				return false;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public static function toInt($value, $default) {
128 128
 		$value = trim($value);
129
-		if(is_numeric($value)) {
129
+		if (is_numeric($value)) {
130 130
 			return (int)$value;
131 131
 		} else {
132 132
 			return $default;
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		if (is_integer($value)) {
143 143
 			return $value;
144 144
 		}
145
-		if (is_numeric($value) && ($value == (integer) $value)) {
146
-			return (integer) $value;
145
+		if (is_numeric($value) && ($value == (integer)$value)) {
146
+			return (integer)$value;
147 147
 		}
148 148
 	
149 149
 		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to integer.");
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 		if (is_integer($value) && $value > 0) {
158 158
 			return $value;
159 159
 		}
160
-		if (is_numeric($value) && ($value == (integer) $value) && $value > 0) {
161
-			return (integer) $value;
160
+		if (is_numeric($value) && ($value == (integer)$value) && $value > 0) {
161
+			return (integer)$value;
162 162
 		}
163 163
 	
164 164
 		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a positive integer.");
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 	 * @return Payone_Log4php_LoggerLevel a {@link LoggerLevel} or null
192 192
 	 */
193 193
 	public static function toLevel($value, $defaultValue) {
194
-		if($value === null) {
194
+		if ($value === null) {
195 195
 			return $defaultValue;
196 196
 		}
197 197
 		$hashIndex = strpos($value, '#');
198
-		if($hashIndex === false) {
199
-			if("NULL" == strtoupper($value)) {
198
+		if ($hashIndex === false) {
199
+			if ("NULL" == strtoupper($value)) {
200 200
 				return null;
201 201
 			} else {
202 202
 				// no class name specified : use standard Level class
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 		$levelName = substr($value, 0, $hashIndex);
211 211
 
212 212
 		// This is degenerate case but you never know.
213
-		if("NULL" == strtoupper($levelName)) {
213
+		if ("NULL" == strtoupper($levelName)) {
214 214
 			return null;
215 215
 		}
216 216
 
217 217
 		$clazz = basename($clazz);
218 218
 
219
-		if(class_exists($clazz)) {
219
+		if (class_exists($clazz)) {
220 220
 			$result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
221
-			if(!$result instanceof Payone_Log4php_LoggerLevel) {
221
+			if (!$result instanceof Payone_Log4php_LoggerLevel) {
222 222
 				$result = $defaultValue;
223 223
 			}
224 224
 		} 
@@ -244,23 +244,23 @@  discard block
 block discarded – undo
244 244
 	 * @return float
245 245
 	 */
246 246
 	public static function toFileSize($value, $default) {
247
-		if($value === null) {
247
+		if ($value === null) {
248 248
 			return $default;
249 249
 		}
250 250
 
251 251
 		$s = strtoupper(trim($value));
252 252
 		$multiplier = (float)1;
253
-		if(($index = strpos($s, 'KB')) !== false) {
253
+		if (($index = strpos($s, 'KB')) !== false) {
254 254
 			$multiplier = 1024;
255 255
 			$s = substr($s, 0, $index);
256
-		} else if(($index = strpos($s, 'MB')) !== false) {
256
+		} else if (($index = strpos($s, 'MB')) !== false) {
257 257
 			$multiplier = 1024 * 1024;
258 258
 			$s = substr($s, 0, $index);
259
-		} else if(($index = strpos($s, 'GB')) !== false) {
259
+		} else if (($index = strpos($s, 'GB')) !== false) {
260 260
 			$multiplier = 1024 * 1024 * 1024;
261 261
 			$s = substr($s, 0, $index);
262 262
 		}
263
-		if(is_numeric($s)) {
263
+		if (is_numeric($s)) {
264 264
 			return (float)$s * $multiplier;
265 265
 		} 
266 266
 		return $default;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		}
291 291
 		
292 292
 		if (is_numeric($value)) {
293
-			return (integer) $value;
293
+			return (integer)$value;
294 294
 		}
295 295
 		
296 296
 		if (!is_string($value)) {
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
 			$size = $matches[1];
305 305
 			$unit = $matches[2];
306 306
 			
307
-			switch($unit) {
307
+			switch ($unit) {
308 308
 				case 'KB': $size *= pow(1024, 1); break;
309 309
 				case 'MB': $size *= pow(1024, 2); break;
310 310
 				case 'GB': $size *= pow(1024, 3); break;
311 311
 			}
312 312
 			
313
-			return (integer) $size;
313
+			return (integer)$size;
314 314
 		}
315 315
 		
316 316
 		throw new Payone_Log4php_LoggerException("Given value [$value] cannot be converted to a file size.");
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			return $value;
329 329
 		}
330 330
 		if (is_numeric($value)) {
331
-			return (string) $value;
331
+			return (string)$value;
332 332
 		}
333 333
 		if (is_object($value) && method_exists($value, '__toString')) {
334
-			return (string) $value;
334
+			return (string)$value;
335 335
 		}
336 336
 	
337 337
 		throw new Payone_Log4php_LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to string.");
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 	public static function substVars($val, $props = null) {
407 407
 		$sbuf = '';
408 408
 		$i = 0;
409
-		while(true) {
409
+		while (true) {
410 410
 			$j = strpos($val, self::DELIM_START, $i);
411
-			if($j === false) {
411
+			if ($j === false) {
412 412
 				// no more variables
413
-				if($i == 0) { // this is a simple string
413
+				if ($i == 0) { // this is a simple string
414 414
 					return $val;
415 415
 				} else { // add the tail string which contails no variables and return the result.
416 416
 					$sbuf .= substr($val, $i);
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 				}
419 419
 			} else {
420 420
 			
421
-				$sbuf .= substr($val, $i, $j-$i);
421
+				$sbuf .= substr($val, $i, $j - $i);
422 422
 				$k = strpos($val, self::DELIM_STOP, $j);
423
-				if($k === false) {
423
+				if ($k === false) {
424 424
 					// LoggerOptionConverter::substVars() has no closing brace. Opening brace
425 425
 					return '';
426 426
 				} else {
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
 					// first try in System properties
430 430
 					$replacement = Payone_Log4php_LoggerOptionConverter::getSystemProperty($key, null);
431 431
 					// then try props parameter
432
-					if($replacement == null and $props !== null) {
432
+					if ($replacement == null and $props !== null) {
433 433
 						$replacement = @$props[$key];
434 434
 					}
435 435
 
436
-					if(!empty($replacement)) {
436
+					if (!empty($replacement)) {
437 437
 						// Do variable substitution on the replacement string
438 438
 						// such that we can solve "Hello ${x2}" as "Hello p1" 
439 439
 						// the where the properties are
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterThrowable.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,41 +28,41 @@
 block discarded – undo
28 28
  */
29 29
 class Payone_Log4php_LoggerPatternConverterThrowable extends Payone_Log4php_LoggerPatternConverter {
30 30
 	
31
-	private $depth;
31
+    private $depth;
32 32
 	
33
-	public function activateOptions() {
34
-		if (isset($this->option) && is_numeric($op) && $op >= 0) {
35
-			$this->depth = (integer) $this->option;
36
-		}
37
-	}
33
+    public function activateOptions() {
34
+        if (isset($this->option) && is_numeric($op) && $op >= 0) {
35
+            $this->depth = (integer) $this->option;
36
+        }
37
+    }
38 38
 	
39
-	public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
39
+    public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
40 40
 		
41
-		$info = $event->getThrowableInformation();
42
-		if ($info === null) {
43
-			return '';
44
-		}
41
+        $info = $event->getThrowableInformation();
42
+        if ($info === null) {
43
+            return '';
44
+        }
45 45
 		
46
-		$ex = $info->getThrowable();
46
+        $ex = $info->getThrowable();
47 47
 		
48
-		// Format exception to string
49
-		$strEx = get_class($ex) . ': "' . $ex->getMessage() . '"' . PHP_EOL;
50
-		$strEx .= 'at '. $ex->getFile() . ':' . $ex->getLine();
48
+        // Format exception to string
49
+        $strEx = get_class($ex) . ': "' . $ex->getMessage() . '"' . PHP_EOL;
50
+        $strEx .= 'at '. $ex->getFile() . ':' . $ex->getLine();
51 51
 		
52
-		// Add trace if required
53
-		if ($this->depth === null || $this->depth > 0) {
54
-			$trace = $ex->getTrace();
55
-			foreach($trace as $key => $item) {
56
-				if (isset($this->depth) && $key > $this->depth) {
57
-					break;
58
-				}
59
-				$strEx .= PHP_EOL . "#$key " . 
60
-					"{$item['file']}:{$item['line']} " .
61
-					"in {$item['class']}{$item['type']}{$item['function']}()"; 
62
-			}
63
-		}
52
+        // Add trace if required
53
+        if ($this->depth === null || $this->depth > 0) {
54
+            $trace = $ex->getTrace();
55
+            foreach($trace as $key => $item) {
56
+                if (isset($this->depth) && $key > $this->depth) {
57
+                    break;
58
+                }
59
+                $strEx .= PHP_EOL . "#$key " . 
60
+                    "{$item['file']}:{$item['line']} " .
61
+                    "in {$item['class']}{$item['type']}{$item['function']}()"; 
62
+            }
63
+        }
64 64
 		
65
-		return $strEx;
66
-	}
65
+        return $strEx;
66
+    }
67 67
 }
68
- 
69 68
\ No newline at end of file
69
+    
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	public function activateOptions() {
34 34
 		if (isset($this->option) && is_numeric($op) && $op >= 0) {
35
-			$this->depth = (integer) $this->option;
35
+			$this->depth = (integer)$this->option;
36 36
 		}
37 37
 	}
38 38
 	
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 		
48 48
 		// Format exception to string
49 49
 		$strEx = get_class($ex) . ': "' . $ex->getMessage() . '"' . PHP_EOL;
50
-		$strEx .= 'at '. $ex->getFile() . ':' . $ex->getLine();
50
+		$strEx .= 'at ' . $ex->getFile() . ':' . $ex->getLine();
51 51
 		
52 52
 		// Add trace if required
53 53
 		if ($this->depth === null || $this->depth > 0) {
54 54
 			$trace = $ex->getTrace();
55
-			foreach($trace as $key => $item) {
55
+			foreach ($trace as $key => $item) {
56 56
 				if (isset($this->depth) && $key > $this->depth) {
57 57
 					break;
58 58
 				}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerUtils.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -27,97 +27,97 @@
 block discarded – undo
27 27
  */
28 28
 class Payone_Log4php_LoggerUtils {
29 29
 	
30
-	/**
31
- 	 * Splits a fully qualified class name into fragments delimited by the 
32
- 	 * namespace separator (\). 
33
- 	 * 
34
- 	 * For backward compatibility, a dot (.) can be used as a delimiter as
35
- 	 * well. 
36
-	 * 
37
-	 * @param string $name
38
-	 * 
39
-	 * @return array Class name split into fragments.
40
-	 */
41
-	public static function tokenizeClassName($name) {
42
-		$name = str_replace('.', '\\', $name);
43
-		$name = trim($name, ' \\');
44
-		$fragments = explode('\\', $name);
30
+    /**
31
+     * Splits a fully qualified class name into fragments delimited by the 
32
+     * namespace separator (\). 
33
+     * 
34
+     * For backward compatibility, a dot (.) can be used as a delimiter as
35
+     * well. 
36
+     * 
37
+     * @param string $name
38
+     * 
39
+     * @return array Class name split into fragments.
40
+     */
41
+    public static function tokenizeClassName($name) {
42
+        $name = str_replace('.', '\\', $name);
43
+        $name = trim($name, ' \\');
44
+        $fragments = explode('\\', $name);
45 45
 		
46
-		foreach($fragments as $key => $fragment) {
47
-			if (trim($fragment) === '') {
48
-				unset($fragments[$key]);
49
-			}
50
-		}
46
+        foreach($fragments as $key => $fragment) {
47
+            if (trim($fragment) === '') {
48
+                unset($fragments[$key]);
49
+            }
50
+        }
51 51
 		
52
-		return $fragments;
53
-	}
52
+        return $fragments;
53
+    }
54 54
 	
55
-	/**
56
-	 * Attempts to shorten the given class name to the desired length.
57
-	 * 
58
-	 * This is done by separating the class name into fragments (delimited
59
-	 * by \ or .) and trimming individual fragments, starting with the left,
60
-	 * until desired length has been reached. 
61
-	 * 
62
-	 * The final fragment (i.e. class name) will never be shortened so the 
63
-	 * result may still be longer than given length.
64
-	 * 
65
-	 * @param string $name The (qualified) class name.  
66
-	 * @param integer $length The length to shorten to. If null or 0 is given,
67
-	 * the name will be returned without shortening. 
68
-	 */
69
-	public static function shortenClassName($name, $length) {
70
-		if ($length === null || $length < 0) {
71
-			return $name;
72
-		}
55
+    /**
56
+     * Attempts to shorten the given class name to the desired length.
57
+     * 
58
+     * This is done by separating the class name into fragments (delimited
59
+     * by \ or .) and trimming individual fragments, starting with the left,
60
+     * until desired length has been reached. 
61
+     * 
62
+     * The final fragment (i.e. class name) will never be shortened so the 
63
+     * result may still be longer than given length.
64
+     * 
65
+     * @param string $name The (qualified) class name.  
66
+     * @param integer $length The length to shorten to. If null or 0 is given,
67
+     * the name will be returned without shortening. 
68
+     */
69
+    public static function shortenClassName($name, $length) {
70
+        if ($length === null || $length < 0) {
71
+            return $name;
72
+        }
73 73
 		
74
-		$name = str_replace('.', '\\', $name);
75
-		$name = trim($name, ' \\');
74
+        $name = str_replace('.', '\\', $name);
75
+        $name = trim($name, ' \\');
76 76
 		
77
-		// Check if any shortening is required
78
-		$currentLength = strlen($name);
79
-		if ($currentLength <= $length) {
80
-			return $name;
81
-		}
77
+        // Check if any shortening is required
78
+        $currentLength = strlen($name);
79
+        if ($currentLength <= $length) {
80
+            return $name;
81
+        }
82 82
 	
83
-		// Split name into fragments
84
-		$fragments = explode('\\', $name);
83
+        // Split name into fragments
84
+        $fragments = explode('\\', $name);
85 85
 
86
-		// If zero length is specified, return only last fragment
87
-		if ($length == 0) {
88
-			return array_pop($fragments);
89
-		}
86
+        // If zero length is specified, return only last fragment
87
+        if ($length == 0) {
88
+            return array_pop($fragments);
89
+        }
90 90
 		
91
-		// If the name splits to only one fragment, then it cannot be shortened
92
-		$count = count($fragments);
93
-		if ($count == 1) {
94
-			return $name;
95
-		}
91
+        // If the name splits to only one fragment, then it cannot be shortened
92
+        $count = count($fragments);
93
+        if ($count == 1) {
94
+            return $name;
95
+        }
96 96
 	
97
-		foreach($fragments as $key => &$fragment) {
97
+        foreach($fragments as $key => &$fragment) {
98 98
 	
99
-			// Never shorten last fragment
100
-			if ($key == $count - 1) {
101
-				break;
102
-			}
99
+            // Never shorten last fragment
100
+            if ($key == $count - 1) {
101
+                break;
102
+            }
103 103
 	
104
-			// Check for empty fragments (shouldn't happen but it's possible)
105
-			$fragLen = strlen($fragment);
106
-			if ($fragLen <= 1) {
107
-				continue;
108
-			}
104
+            // Check for empty fragments (shouldn't happen but it's possible)
105
+            $fragLen = strlen($fragment);
106
+            if ($fragLen <= 1) {
107
+                continue;
108
+            }
109 109
 	
110
-			// Shorten fragment to one character and check if total length satisfactory
111
-			$fragment = substr($fragment, 0, 1);
112
-			$currentLength = $currentLength - $fragLen + 1;
110
+            // Shorten fragment to one character and check if total length satisfactory
111
+            $fragment = substr($fragment, 0, 1);
112
+            $currentLength = $currentLength - $fragLen + 1;
113 113
 	
114
-			if ($currentLength <= $length) {
115
-				break;
116
-			}
117
-		}
118
-		unset($fragment);
114
+            if ($currentLength <= $length) {
115
+                break;
116
+            }
117
+        }
118
+        unset($fragment);
119 119
 	
120
-		return implode('\\', $fragments);
121
-	}
120
+        return implode('\\', $fragments);
121
+    }
122 122
 }
123 123
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$name = trim($name, ' \\');
44 44
 		$fragments = explode('\\', $name);
45 45
 		
46
-		foreach($fragments as $key => $fragment) {
46
+		foreach ($fragments as $key => $fragment) {
47 47
 			if (trim($fragment) === '') {
48 48
 				unset($fragments[$key]);
49 49
 			}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			return $name;
95 95
 		}
96 96
 	
97
-		foreach($fragments as $key => &$fragment) {
97
+		foreach ($fragments as $key => &$fragment) {
98 98
 	
99 99
 			// Never shorten last fragment
100 100
 			if ($key == $count - 1) {
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderConsole.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -43,63 +43,63 @@
 block discarded – undo
43 43
  */
44 44
 class Payone_Log4php_LoggerAppenderConsole extends Payone_Log4php_LoggerAppender {
45 45
 
46
-	const STDOUT = 'php://stdout';
47
-	const STDERR = 'php://stderr';
46
+    const STDOUT = 'php://stdout';
47
+    const STDERR = 'php://stderr';
48 48
 
49
-	/**
50
-	 * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
51
-	 * Default is STDOUT
52
-	 * @var string
53
-	 */
54
-	protected $target = self::STDOUT;
49
+    /**
50
+     * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
51
+     * Default is STDOUT
52
+     * @var string
53
+     */
54
+    protected $target = self::STDOUT;
55 55
 	
56
-	/**
57
-	 * @var mixed the resource used to open stdout/stderr
58
-	 */
59
-	protected $fp = null;
56
+    /**
57
+     * @var mixed the resource used to open stdout/stderr
58
+     */
59
+    protected $fp = null;
60 60
 
61
-	/**
62
-	 * Set console target.
63
-	 * @param mixed $value a constant or a string
64
-	 */
65
-	public function setTarget($value) {
66
-		$v = trim($value);
67
-		if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
68
-			$this->target = self::STDOUT;
69
-		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
70
-			$this->target = self::STDERR;
71
-		} else {
72
-			$value = var_export($value);
73
-			$this->warn("Invalid value given for 'target' property: [$value]. Property not set.");
74
-		}
75
-	}
61
+    /**
62
+     * Set console target.
63
+     * @param mixed $value a constant or a string
64
+     */
65
+    public function setTarget($value) {
66
+        $v = trim($value);
67
+        if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
68
+            $this->target = self::STDOUT;
69
+        } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
70
+            $this->target = self::STDERR;
71
+        } else {
72
+            $value = var_export($value);
73
+            $this->warn("Invalid value given for 'target' property: [$value]. Property not set.");
74
+        }
75
+    }
76 76
 
77
-	public function getTarget() {
78
-		return $this->target;
79
-	}
77
+    public function getTarget() {
78
+        return $this->target;
79
+    }
80 80
 
81
-	public function activateOptions() {
82
-		$this->fp = fopen($this->target, 'w');
83
-		if(is_resource($this->fp) && $this->layout !== null) {
84
-			fwrite($this->fp, $this->layout->getHeader());
85
-		}
86
-		$this->closed = (bool)is_resource($this->fp) === false;
87
-	}
81
+    public function activateOptions() {
82
+        $this->fp = fopen($this->target, 'w');
83
+        if(is_resource($this->fp) && $this->layout !== null) {
84
+            fwrite($this->fp, $this->layout->getHeader());
85
+        }
86
+        $this->closed = (bool)is_resource($this->fp) === false;
87
+    }
88 88
 	
89
-	public function close() {
90
-		if($this->closed != true) {
91
-			if (is_resource($this->fp) && $this->layout !== null) {
92
-				fwrite($this->fp, $this->layout->getFooter());
93
-				fclose($this->fp);
94
-			}
95
-			$this->closed = true;
96
-		}
97
-	}
89
+    public function close() {
90
+        if($this->closed != true) {
91
+            if (is_resource($this->fp) && $this->layout !== null) {
92
+                fwrite($this->fp, $this->layout->getFooter());
93
+                fclose($this->fp);
94
+            }
95
+            $this->closed = true;
96
+        }
97
+    }
98 98
 
99
-	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
100
-		if (is_resource($this->fp) && $this->layout !== null) {
101
-			fwrite($this->fp, $this->layout->format($event));
102
-		}
103
-	}
99
+    public function append(Payone_Log4php_LoggerLoggingEvent $event) {
100
+        if (is_resource($this->fp) && $this->layout !== null) {
101
+            fwrite($this->fp, $this->layout->format($event));
102
+        }
103
+    }
104 104
 }
105 105
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,14 +80,14 @@
 block discarded – undo
80 80
 
81 81
 	public function activateOptions() {
82 82
 		$this->fp = fopen($this->target, 'w');
83
-		if(is_resource($this->fp) && $this->layout !== null) {
83
+		if (is_resource($this->fp) && $this->layout !== null) {
84 84
 			fwrite($this->fp, $this->layout->getHeader());
85 85
 		}
86 86
 		$this->closed = (bool)is_resource($this->fp) === false;
87 87
 	}
88 88
 	
89 89
 	public function close() {
90
-		if($this->closed != true) {
90
+		if ($this->closed != true) {
91 91
 			if (is_resource($this->fp) && $this->layout !== null) {
92 92
 				fwrite($this->fp, $this->layout->getFooter());
93 93
 				fclose($this->fp);
Please login to merge, or discard this patch.