Completed
Push — master ( a010d0...acbc61 )
by Florian
04:56
created
lib/Payone/Log4php/LoggerPatternConverterEnvironment.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_LoggerPatternConverterEnvironment extends Payone_Log4php_LoggerPatternConverterSuperglobal {
32
-	protected $name = '_ENV';
32
+    protected $name = '_ENV';
33 33
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterCookie.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_LoggerPatternConverterCookie extends Payone_Log4php_LoggerPatternConverterSuperglobal {
32
-	protected $name = '_COOKIE';
32
+    protected $name = '_COOKIE';
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLayoutSimple.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,18 +39,18 @@
 block discarded – undo
39 39
  * @subpackage layouts
40 40
  */  
41 41
 class Payone_Log4php_LoggerLayoutSimple extends Payone_Log4php_LoggerLayout {
42
-	/**
43
-	 * Returns the log statement in a format consisting of the
44
-	 * <b>level</b>, followed by " - " and then the
45
-	 * <b>message</b>. For example, 
46
-	 * <samp> INFO - "A message" </samp>
47
-	 *
48
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
49
-	 * @return string
50
-	 */
51
-	public function format(Payone_Log4php_LoggerLoggingEvent $event) {
52
-		$level = $event->getLevel();
53
-		$message = $event->getRenderedMessage();
54
-		return "$level - $message" . PHP_EOL;
55
-	}
42
+    /**
43
+     * Returns the log statement in a format consisting of the
44
+     * <b>level</b>, followed by " - " and then the
45
+     * <b>message</b>. For example, 
46
+     * <samp> INFO - "A message" </samp>
47
+     *
48
+     * @param Payone_Log4php_LoggerLoggingEvent $event
49
+     * @return string
50
+     */
51
+    public function format(Payone_Log4php_LoggerLoggingEvent $event) {
52
+        $level = $event->getLevel();
53
+        $message = $event->getRenderedMessage();
54
+        return "$level - $message" . PHP_EOL;
55
+    }
56 56
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerConfigurable.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -29,89 +29,89 @@
 block discarded – undo
29 29
  */
30 30
 abstract class Payone_Log4php_LoggerConfigurable {
31 31
 	
32
-	/** Setter function for boolean type. */
33
-	protected function setBoolean($property, $value) {
34
-		try {
35
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toBooleanEx($value);
36
-		} catch (Exception $ex) {
37
-			$value = var_export($value, true);
38
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected a boolean value. Property not changed.");
39
-		}
40
-	}
32
+    /** Setter function for boolean type. */
33
+    protected function setBoolean($property, $value) {
34
+        try {
35
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toBooleanEx($value);
36
+        } catch (Exception $ex) {
37
+            $value = var_export($value, true);
38
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected a boolean value. Property not changed.");
39
+        }
40
+    }
41 41
 	
42
-	/** Setter function for integer type. */
43
-	protected function setInteger($property, $value) {
44
-		try {
45
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toIntegerEx($value);
46
-		} catch (Exception $ex) {
47
-			$value = var_export($value, true);
48
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected an integer. Property not changed.");
49
-		}
50
-	}
42
+    /** Setter function for integer type. */
43
+    protected function setInteger($property, $value) {
44
+        try {
45
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toIntegerEx($value);
46
+        } catch (Exception $ex) {
47
+            $value = var_export($value, true);
48
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected an integer. Property not changed.");
49
+        }
50
+    }
51 51
 	
52
-	/** Setter function for LoggerLevel values. */
53
-	protected function setLevel($property, $value) {
54
-		try {
55
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toLevelEx($value);
56
-		} catch (Exception $ex) {
57
-			$value = var_export($value, true);
58
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected a level value. Property not changed.");
59
-		}
60
-	}
52
+    /** Setter function for LoggerLevel values. */
53
+    protected function setLevel($property, $value) {
54
+        try {
55
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toLevelEx($value);
56
+        } catch (Exception $ex) {
57
+            $value = var_export($value, true);
58
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected a level value. Property not changed.");
59
+        }
60
+    }
61 61
 	
62
-	/** Setter function for integer type. */
63
-	protected function setPositiveInteger($property, $value) {
64
-		try {
65
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toPositiveIntegerEx($value);
66
-		} catch (Exception $ex) {
67
-			$value = var_export($value, true);
68
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected a positive integer. Property not changed.");
69
-		}
70
-	}
62
+    /** Setter function for integer type. */
63
+    protected function setPositiveInteger($property, $value) {
64
+        try {
65
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toPositiveIntegerEx($value);
66
+        } catch (Exception $ex) {
67
+            $value = var_export($value, true);
68
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected a positive integer. Property not changed.");
69
+        }
70
+    }
71 71
 	
72
-	/** Setter for file size. */
73
-	protected function setFileSize($property, $value) {
74
-		try {
75
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toFileSizeEx($value);
76
-		} catch (Exception $ex) {
77
-			$value = var_export($value, true);
78
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected a file size value.  Property not changed.");
79
-		}
80
-	}
72
+    /** Setter for file size. */
73
+    protected function setFileSize($property, $value) {
74
+        try {
75
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toFileSizeEx($value);
76
+        } catch (Exception $ex) {
77
+            $value = var_export($value, true);
78
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected a file size value.  Property not changed.");
79
+        }
80
+    }
81 81
 	
82
-	/** Setter function for numeric type. */
83
-	protected function setNumeric($property, $value) {
84
-		try {
85
-			$this->$property = Payone_Log4php_LoggerOptionConverter::toNumericEx($value);
86
-		} catch (Exception $ex) {
87
-			$value = var_export($value, true);
88
-			$this->warn("Invalid value given for '$property' property: [$value]. Expected a number. Property not changed.");
89
-		}
90
-	}
82
+    /** Setter function for numeric type. */
83
+    protected function setNumeric($property, $value) {
84
+        try {
85
+            $this->$property = Payone_Log4php_LoggerOptionConverter::toNumericEx($value);
86
+        } catch (Exception $ex) {
87
+            $value = var_export($value, true);
88
+            $this->warn("Invalid value given for '$property' property: [$value]. Expected a number. Property not changed.");
89
+        }
90
+    }
91 91
 	
92
-	/** Setter function for string type. */
93
-	protected function setString($property, $value, $nullable = false) {
94
-		if ($value === null) {
95
-			if($nullable) {
96
-				$this->$property= null;
97
-			} else {
98
-				$this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
99
-			}
100
-		} else {
101
-			try {
102
-				$this->$property = Payone_Log4php_LoggerOptionConverter::toStringEx($value);
103
-			} catch (Exception $ex) {
104
-				$value = var_export($value, true);
105
-				$this->warn("Invalid value given for '$property' property: [$value]. Expected a string. Property not changed.");
106
-			}
107
-		}
108
-	}
92
+    /** Setter function for string type. */
93
+    protected function setString($property, $value, $nullable = false) {
94
+        if ($value === null) {
95
+            if($nullable) {
96
+                $this->$property= null;
97
+            } else {
98
+                $this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
99
+            }
100
+        } else {
101
+            try {
102
+                $this->$property = Payone_Log4php_LoggerOptionConverter::toStringEx($value);
103
+            } catch (Exception $ex) {
104
+                $value = var_export($value, true);
105
+                $this->warn("Invalid value given for '$property' property: [$value]. Expected a string. Property not changed.");
106
+            }
107
+        }
108
+    }
109 109
 	
110
-	/** Triggers a warning. */
111
-	protected function warn($message) {
112
-		$class = get_class($this);
113
-		trigger_error("log4php: $class: $message", E_USER_WARNING);
114
-	}
110
+    /** Triggers a warning. */
111
+    protected function warn($message) {
112
+        $class = get_class($this);
113
+        trigger_error("log4php: $class: $message", E_USER_WARNING);
114
+    }
115 115
 }
116 116
 
117 117
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@
 block discarded – undo
92 92
 	/** Setter function for string type. */
93 93
 	protected function setString($property, $value, $nullable = false) {
94 94
 		if ($value === null) {
95
-			if($nullable) {
96
-				$this->$property= null;
95
+			if ($nullable) {
96
+				$this->$property = null;
97 97
 			} else {
98 98
 				$this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
99 99
 			}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterSession.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_LoggerPatternConverterSession extends Payone_Log4php_LoggerPatternConverterSuperglobal {
32
-	protected $name = '_SESSION';
32
+    protected $name = '_SESSION';
33 33
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterLocation.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
  */
28 28
 class Payone_Log4php_LoggerPatternConverterLine extends Payone_Log4php_LoggerPatternConverter {
29 29
 
30
-	public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
31
-		return 
32
-			$event->getLocationInformation()->getClassName() . '.' .
33
-			$event->getLocationInformation()->getMethodName() . '(' .
34
-			$event->getLocationInformation()->getFileName() . ':' .
35
-			$event->getLocationInformation()->getLineNumber() . ')';
36
-	}
30
+    public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
31
+        return 
32
+            $event->getLocationInformation()->getClassName() . '.' .
33
+            $event->getLocationInformation()->getMethodName() . '(' .
34
+            $event->getLocationInformation()->getFileName() . ':' .
35
+            $event->getLocationInformation()->getLineNumber() . ')';
36
+    }
37 37
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverterLogger.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -29,86 +29,86 @@
 block discarded – undo
29 29
  */
30 30
 class Payone_Log4php_LoggerPatternConverterLogger extends Payone_Log4php_LoggerPatternConverter {
31 31
 
32
-	/** Length to which to shorten the name. */
33
-	private $length;
32
+    /** Length to which to shorten the name. */
33
+    private $length;
34 34
 	
35
-	/** Holds processed logger names. */
36
-	private $cache = array();
35
+    /** Holds processed logger names. */
36
+    private $cache = array();
37 37
 	
38
-	public function activateOptions() {
39
-		// Parse the option (desired output length)
40
-		if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
41
-			$this->length = (integer) $this->option;
42
-		}
43
-	}
38
+    public function activateOptions() {
39
+        // Parse the option (desired output length)
40
+        if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
41
+            $this->length = (integer) $this->option;
42
+        }
43
+    }
44 44
 	
45
-	public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
46
-		$name = $event->getLoggerName();
45
+    public function convert(Payone_Log4php_LoggerLoggingEvent $event) {
46
+        $name = $event->getLoggerName();
47 47
 		
48
-		if (!isset($this->cache[$name])) {
48
+        if (!isset($this->cache[$name])) {
49 49
 
50
-			// If length is set return shortened logger name 
51
-			if (isset($this->length)) {
52
-				$this->cache[$name] = $this->shorten($name, $this->length);
53
-			} 
50
+            // If length is set return shortened logger name 
51
+            if (isset($this->length)) {
52
+                $this->cache[$name] = $this->shorten($name, $this->length);
53
+            } 
54 54
 			 
55
-			// If no length is specified return full logger name
56
-			else {
57
-				$this->cache[$name] = $name;
58
-			}
59
-		} 
55
+            // If no length is specified return full logger name
56
+            else {
57
+                $this->cache[$name] = $name;
58
+            }
59
+        } 
60 60
 		
61
-		return $this->cache[$name];
62
-	}
61
+        return $this->cache[$name];
62
+    }
63 63
 	
64
-	/** 
65
-	 * Attempts to shorten the given name to the desired length by trimming 
66
-	 * name fragments. See docs for examples.
67
-	 */
68
-	private function shorten($name, $length) {
64
+    /** 
65
+     * Attempts to shorten the given name to the desired length by trimming 
66
+     * name fragments. See docs for examples.
67
+     */
68
+    private function shorten($name, $length) {
69 69
 	
70
-		$currentLength = strlen($name);
70
+        $currentLength = strlen($name);
71 71
 	
72
-		// Check if any shortening is required
73
-		if ($currentLength <= $length) {
74
-			return $name;
75
-		}
72
+        // Check if any shortening is required
73
+        if ($currentLength <= $length) {
74
+            return $name;
75
+        }
76 76
 	
77
-		// Split name into fragments
78
-		$name = str_replace('.', '\\', $name);
79
-		$name = trim($name, ' \\');
80
-		$fragments = explode('\\', $name);
81
-		$count = count($fragments);
77
+        // Split name into fragments
78
+        $name = str_replace('.', '\\', $name);
79
+        $name = trim($name, ' \\');
80
+        $fragments = explode('\\', $name);
81
+        $count = count($fragments);
82 82
 	
83
-		// If the name splits to only one fragment, then it cannot be shortened
84
-		if ($count == 1) {
85
-			return $name;
86
-		}
83
+        // If the name splits to only one fragment, then it cannot be shortened
84
+        if ($count == 1) {
85
+            return $name;
86
+        }
87 87
 		
88
-		foreach($fragments as $key => &$fragment) {
88
+        foreach($fragments as $key => &$fragment) {
89 89
 	
90
-			// Never shorten last fragment
91
-			if ($key == $count - 1) {
92
-				break;
93
-			}
90
+            // Never shorten last fragment
91
+            if ($key == $count - 1) {
92
+                break;
93
+            }
94 94
 	
95
-			// Check for empty fragments (shouldn't happen but it's possible)
96
-			$fragLen = strlen($fragment);
97
-			if ($fragLen <= 1) {
98
-				continue;
99
-			}
95
+            // Check for empty fragments (shouldn't happen but it's possible)
96
+            $fragLen = strlen($fragment);
97
+            if ($fragLen <= 1) {
98
+                continue;
99
+            }
100 100
 	
101
-			// Shorten fragment to one character and check if total length satisfactory
102
-			$fragment = substr($fragment, 0, 1);
103
-			$currentLength = $currentLength - $fragLen + 1;
101
+            // Shorten fragment to one character and check if total length satisfactory
102
+            $fragment = substr($fragment, 0, 1);
103
+            $currentLength = $currentLength - $fragLen + 1;
104 104
 	
105
-			if ($currentLength <= $length) {
106
-				break;
107
-			}
108
-		}
109
-		unset($fragment);
105
+            if ($currentLength <= $length) {
106
+                break;
107
+            }
108
+        }
109
+        unset($fragment);
110 110
 	
111
-		return implode('\\', $fragments);
112
-	}
111
+        return implode('\\', $fragments);
112
+    }
113 113
 	
114 114
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	public function activateOptions() {
39 39
 		// Parse the option (desired output length)
40 40
 		if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
41
-			$this->length = (integer) $this->option;
41
+			$this->length = (integer)$this->option;
42 42
 		}
43 43
 	}
44 44
 	
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			return $name;
86 86
 		}
87 87
 		
88
-		foreach($fragments as $key => &$fragment) {
88
+		foreach ($fragments as $key => &$fragment) {
89 89
 	
90 90
 			// Never shorten last fragment
91 91
 			if ($key == $count - 1) {
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerConfigurationAdapterPHP.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -51,35 +51,35 @@
 block discarded – undo
51 51
  */
52 52
 class Payone_Log4php_LoggerConfigurationAdapterPHP implements Payone_Log4php_LoggerConfigurationAdapter
53 53
 {
54
-	public function convert($url) {
55
-		if (!file_exists($url)) {
56
-			throw new Payone_Log4php_LoggerException("File [$url] does not exist.");
57
-		}
54
+    public function convert($url) {
55
+        if (!file_exists($url)) {
56
+            throw new Payone_Log4php_LoggerException("File [$url] does not exist.");
57
+        }
58 58
 		
59
-		// Load the config file
60
-		$data = @file_get_contents($url);
61
-		if ($data === false) {
62
-			$error = error_get_last();
63
-			throw new Payone_Log4php_LoggerException("Error loading config file: {$error['message']}");
64
-		}
59
+        // Load the config file
60
+        $data = @file_get_contents($url);
61
+        if ($data === false) {
62
+            $error = error_get_last();
63
+            throw new Payone_Log4php_LoggerException("Error loading config file: {$error['message']}");
64
+        }
65 65
 		
66
-		$config = @eval('?>' . $data);
66
+        $config = @eval('?>' . $data);
67 67
 		
68
-		if ($config === false) {
69
-			$error = error_get_last();
70
-			throw new Payone_Log4php_LoggerException("Error parsing configuration: " . $error['message']);
71
-		}
68
+        if ($config === false) {
69
+            $error = error_get_last();
70
+            throw new Payone_Log4php_LoggerException("Error parsing configuration: " . $error['message']);
71
+        }
72 72
 		
73
-		if (empty($config)) {
74
-			throw new Payone_Log4php_LoggerException("Invalid configuration: empty configuration array.");
75
-		}
73
+        if (empty($config)) {
74
+            throw new Payone_Log4php_LoggerException("Invalid configuration: empty configuration array.");
75
+        }
76 76
 		
77
-		if (!is_array($config)) {
78
-			throw new Payone_Log4php_LoggerException("Invalid configuration: not an array.");
79
-		}
77
+        if (!is_array($config)) {
78
+            throw new Payone_Log4php_LoggerException("Invalid configuration: not an array.");
79
+        }
80 80
 		
81
-		return $config;
82
-	}
81
+        return $config;
82
+    }
83 83
 }
84 84
 
85 85
 ?>
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerConfigurationAdapter.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
  */
33 33
 interface Payone_Log4php_LoggerConfigurationAdapter
34 34
 {
35
-	/** Converts the configuration file to PHP format usable by the configurator. */
36
-	public function convert($input); 
35
+    /** Converts the configuration file to PHP format usable by the configurator. */
36
+    public function convert($input); 
37 37
 
38 38
 }
39 39
 
Please login to merge, or discard this patch.