Completed
Push — master ( 6da602...e92961 )
by Florian
04:20
created
lib/Payone/Log4php/LoggerFilterLevelMatch.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,6 @@
 block discarded – undo
67 67
 	}
68 68
 	
69 69
 	/**
70
-	 * @param string $l the level to match
71 70
 	 */
72 71
 	public function setLevelToMatch($level) {
73 72
 		$this->setLevel('levelToMatch', $level);
Please login to merge, or discard this patch.
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -47,54 +47,54 @@
 block discarded – undo
47 47
  */
48 48
 class Payone_Log4php_LoggerFilterLevelMatch extends Payone_Log4php_LoggerFilter {
49 49
   
50
-	/** 
51
-	 * Indicates if this event should be accepted or denied on match
52
-	 * @var boolean
53
-	 */
54
-	protected $acceptOnMatch = true;
50
+    /** 
51
+     * Indicates if this event should be accepted or denied on match
52
+     * @var boolean
53
+     */
54
+    protected $acceptOnMatch = true;
55 55
 
56
-	/**
57
-	 * The level, when to match
58
-	 * @var Payone_Log4php_LoggerLevel
59
-	 */
60
-	protected $levelToMatch;
56
+    /**
57
+     * The level, when to match
58
+     * @var Payone_Log4php_LoggerLevel
59
+     */
60
+    protected $levelToMatch;
61 61
   
62
-	/**
63
-	 * @param boolean $acceptOnMatch
64
-	 */
65
-	public function setAcceptOnMatch($acceptOnMatch) {
66
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
67
-	}
62
+    /**
63
+     * @param boolean $acceptOnMatch
64
+     */
65
+    public function setAcceptOnMatch($acceptOnMatch) {
66
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
67
+    }
68 68
 	
69
-	/**
70
-	 * @param string $l the level to match
71
-	 */
72
-	public function setLevelToMatch($level) {
73
-		$this->setLevel('levelToMatch', $level);
74
-	}
69
+    /**
70
+     * @param string $l the level to match
71
+     */
72
+    public function setLevelToMatch($level) {
73
+        $this->setLevel('levelToMatch', $level);
74
+    }
75 75
 
76
-	/**
77
-	 * Return the decision of this filter.
78
-	 * 
79
-	 * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
80
-	 * option is not set or if there is not match.	Otherwise, if there is a
81
-	 * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
82
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
83
-	 * returned decision is {@link LoggerFilter::DENY} if the
84
-	 * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
85
-	 *
86
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
87
-	 * @return integer
88
-	 */
89
-	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
90
-		if($this->levelToMatch === null) {
91
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
92
-		}
76
+    /**
77
+     * Return the decision of this filter.
78
+     * 
79
+     * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
80
+     * option is not set or if there is not match.	Otherwise, if there is a
81
+     * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
82
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
83
+     * returned decision is {@link LoggerFilter::DENY} if the
84
+     * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
85
+     *
86
+     * @param Payone_Log4php_LoggerLoggingEvent $event
87
+     * @return integer
88
+     */
89
+    public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
90
+        if($this->levelToMatch === null) {
91
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
92
+        }
93 93
 		
94
-		if($this->levelToMatch->equals($event->getLevel())) {	
95
-			return $this->acceptOnMatch ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
96
-		} else {
97
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
98
-		}
99
-	}
94
+        if($this->levelToMatch->equals($event->getLevel())) {	
95
+            return $this->acceptOnMatch ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
96
+        } else {
97
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
98
+        }
99
+    }
100 100
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,11 +87,11 @@
 block discarded – undo
87 87
 	 * @return integer
88 88
 	 */
89 89
 	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
90
-		if($this->levelToMatch === null) {
90
+		if ($this->levelToMatch === null) {
91 91
 			return Payone_Log4php_LoggerFilter::NEUTRAL;
92 92
 		}
93 93
 		
94
-		if($this->levelToMatch->equals($event->getLevel())) {	
94
+		if ($this->levelToMatch->equals($event->getLevel())) {	
95 95
 			return $this->acceptOnMatch ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
96 96
 		} else {
97 97
 			return Payone_Log4php_LoggerFilter::NEUTRAL;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerFilterLevelRange.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -87,14 +87,12 @@
 block discarded – undo
87 87
 	}
88 88
 	
89 89
 	/**
90
-	 * @param string $l the level min to match
91 90
 	 */
92 91
 	public function setLevelMin($level) {
93 92
 		$this->setLevel('levelMin', $level);
94 93
 	}
95 94
 
96 95
 	/**
97
-	 * @param string $l the level max to match
98 96
 	 */
99 97
 	public function setLevelMax($level) {
100 98
 		$this->setLevel('levelMax', $level);
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -64,75 +64,75 @@
 block discarded – undo
64 64
  */
65 65
 class Payone_Log4php_LoggerFilterLevelRange extends Payone_Log4php_LoggerFilter {
66 66
 
67
-	/**
68
-	 * @var boolean
69
-	 */
70
-	protected $acceptOnMatch = true;
67
+    /**
68
+     * @var boolean
69
+     */
70
+    protected $acceptOnMatch = true;
71 71
 
72
-	/**
73
-	 * @var Payone_Log4php_LoggerLevel
74
-	 */
75
-	protected $levelMin;
72
+    /**
73
+     * @var Payone_Log4php_LoggerLevel
74
+     */
75
+    protected $levelMin;
76 76
   
77
-	/**
78
-	 * @var Payone_Log4php_LoggerLevel
79
-	 */
80
-	protected $levelMax;
77
+    /**
78
+     * @var Payone_Log4php_LoggerLevel
79
+     */
80
+    protected $levelMax;
81 81
 
82
-	/**
83
-	 * @param boolean $acceptOnMatch
84
-	 */
85
-	public function setAcceptOnMatch($acceptOnMatch) {
86
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch); 
87
-	}
82
+    /**
83
+     * @param boolean $acceptOnMatch
84
+     */
85
+    public function setAcceptOnMatch($acceptOnMatch) {
86
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch); 
87
+    }
88 88
 	
89
-	/**
90
-	 * @param string $l the level min to match
91
-	 */
92
-	public function setLevelMin($level) {
93
-		$this->setLevel('levelMin', $level);
94
-	}
89
+    /**
90
+     * @param string $l the level min to match
91
+     */
92
+    public function setLevelMin($level) {
93
+        $this->setLevel('levelMin', $level);
94
+    }
95 95
 
96
-	/**
97
-	 * @param string $l the level max to match
98
-	 */
99
-	public function setLevelMax($level) {
100
-		$this->setLevel('levelMax', $level);
101
-	}
96
+    /**
97
+     * @param string $l the level max to match
98
+     */
99
+    public function setLevelMax($level) {
100
+        $this->setLevel('levelMax', $level);
101
+    }
102 102
 
103
-	/**
104
-	 * Return the decision of this filter.
105
-	 *
106
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
107
-	 * @return integer
108
-	 */
109
-	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110
-		$level = $event->getLevel();
103
+    /**
104
+     * Return the decision of this filter.
105
+     *
106
+     * @param Payone_Log4php_LoggerLoggingEvent $event
107
+     * @return integer
108
+     */
109
+    public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110
+        $level = $event->getLevel();
111 111
 		
112
-		if($this->levelMin !== null) {
113
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
114
-				// level of event is less than minimum
115
-				return Payone_Log4php_LoggerFilter::DENY;
116
-			}
117
-		}
112
+        if($this->levelMin !== null) {
113
+            if($level->isGreaterOrEqual($this->levelMin) == false) {
114
+                // level of event is less than minimum
115
+                return Payone_Log4php_LoggerFilter::DENY;
116
+            }
117
+        }
118 118
 
119
-		if($this->levelMax !== null) {
120
-			if($level->toInt() > $this->levelMax->toInt()) {
121
-				// level of event is greater than maximum
122
-				// Alas, there is no Level.isGreater method. and using
123
-				// a combo of isGreaterOrEqual && !Equal seems worse than
124
-				// checking the int values of the level objects..
125
-				return Payone_Log4php_LoggerFilter::DENY;
126
-			}
127
-		}
119
+        if($this->levelMax !== null) {
120
+            if($level->toInt() > $this->levelMax->toInt()) {
121
+                // level of event is greater than maximum
122
+                // Alas, there is no Level.isGreater method. and using
123
+                // a combo of isGreaterOrEqual && !Equal seems worse than
124
+                // checking the int values of the level objects..
125
+                return Payone_Log4php_LoggerFilter::DENY;
126
+            }
127
+        }
128 128
 
129
-		if($this->acceptOnMatch) {
130
-			// this filter set up to bypass later filters and always return
131
-			// accept if level in range
132
-			return Payone_Log4php_LoggerFilter::ACCEPT;
133
-		} else {
134
-			// event is ok for this filter; allow later filters to have a look..
135
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
136
-		}
137
-	}
129
+        if($this->acceptOnMatch) {
130
+            // this filter set up to bypass later filters and always return
131
+            // accept if level in range
132
+            return Payone_Log4php_LoggerFilter::ACCEPT;
133
+        } else {
134
+            // event is ok for this filter; allow later filters to have a look..
135
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
136
+        }
137
+    }
138 138
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
110 110
 		$level = $event->getLevel();
111 111
 		
112
-		if($this->levelMin !== null) {
113
-			if($level->isGreaterOrEqual($this->levelMin) == false) {
112
+		if ($this->levelMin !== null) {
113
+			if ($level->isGreaterOrEqual($this->levelMin) == false) {
114 114
 				// level of event is less than minimum
115 115
 				return Payone_Log4php_LoggerFilter::DENY;
116 116
 			}
117 117
 		}
118 118
 
119
-		if($this->levelMax !== null) {
120
-			if($level->toInt() > $this->levelMax->toInt()) {
119
+		if ($this->levelMax !== null) {
120
+			if ($level->toInt() > $this->levelMax->toInt()) {
121 121
 				// level of event is greater than maximum
122 122
 				// Alas, there is no Level.isGreater method. and using
123 123
 				// a combo of isGreaterOrEqual && !Equal seems worse than
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 		}
128 128
 
129
-		if($this->acceptOnMatch) {
129
+		if ($this->acceptOnMatch) {
130 130
 			// this filter set up to bypass later filters and always return
131 131
 			// accept if level in range
132 132
 			return Payone_Log4php_LoggerFilter::ACCEPT;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerFilterStringMatch.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,6 @@
 block discarded – undo
65 65
 	}
66 66
 	
67 67
 	/**
68
-	 * @param string $s the string to match
69 68
 	 */
70 69
 	public function setStringToMatch($string) {
71 70
 		$this->setString('stringToMatch', $string);
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -47,43 +47,43 @@
 block discarded – undo
47 47
  */
48 48
 class Payone_Log4php_LoggerFilterStringMatch extends Payone_Log4php_LoggerFilter {
49 49
 
50
-	/**
51
-	 * @var boolean
52
-	 */
53
-	protected $acceptOnMatch = true;
50
+    /**
51
+     * @var boolean
52
+     */
53
+    protected $acceptOnMatch = true;
54 54
 
55
-	/**
56
-	 * @var string
57
-	 */
58
-	protected $stringToMatch;
55
+    /**
56
+     * @var string
57
+     */
58
+    protected $stringToMatch;
59 59
 
60
-	/**
61
-	 * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
62
-	 */
63
-	public function setAcceptOnMatch($acceptOnMatch) {
64
-		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
65
-	}
60
+    /**
61
+     * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
62
+     */
63
+    public function setAcceptOnMatch($acceptOnMatch) {
64
+        $this->setBoolean('acceptOnMatch', $acceptOnMatch);
65
+    }
66 66
 	
67
-	/**
68
-	 * @param string $s the string to match
69
-	 */
70
-	public function setStringToMatch($string) {
71
-		$this->setString('stringToMatch', $string);
72
-	}
67
+    /**
68
+     * @param string $s the string to match
69
+     */
70
+    public function setStringToMatch($string) {
71
+        $this->setString('stringToMatch', $string);
72
+    }
73 73
 
74
-	/**
75
-	 * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
76
-	 */
77
-	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78
-		$msg = $event->getRenderedMessage();
74
+    /**
75
+     * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
76
+     */
77
+    public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78
+        $msg = $event->getRenderedMessage();
79 79
 		
80
-		if($msg === null or $this->stringToMatch === null) {
81
-			return Payone_Log4php_LoggerFilter::NEUTRAL;
82
-		}
80
+        if($msg === null or $this->stringToMatch === null) {
81
+            return Payone_Log4php_LoggerFilter::NEUTRAL;
82
+        }
83 83
 		
84
-		if(strpos($msg, $this->stringToMatch) !== false ) {
85
-			return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86
-		}
87
-		return Payone_Log4php_LoggerFilter::NEUTRAL;
88
-	}
84
+        if(strpos($msg, $this->stringToMatch) !== false ) {
85
+            return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86
+        }
87
+        return Payone_Log4php_LoggerFilter::NEUTRAL;
88
+    }
89 89
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,11 +77,11 @@
 block discarded – undo
77 77
 	public function decide(Payone_Log4php_LoggerLoggingEvent $event) {
78 78
 		$msg = $event->getRenderedMessage();
79 79
 		
80
-		if($msg === null or $this->stringToMatch === null) {
80
+		if ($msg === null or $this->stringToMatch === null) {
81 81
 			return Payone_Log4php_LoggerFilter::NEUTRAL;
82 82
 		}
83 83
 		
84
-		if(strpos($msg, $this->stringToMatch) !== false ) {
84
+		if (strpos($msg, $this->stringToMatch) !== false) {
85 85
 			return ($this->acceptOnMatch) ? Payone_Log4php_LoggerFilter::ACCEPT : Payone_Log4php_LoggerFilter::DENY;
86 86
 		}
87 87
 		return Payone_Log4php_LoggerFilter::NEUTRAL;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerHierarchy.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -213,7 +213,6 @@
 block discarded – undo
213 213
 	
214 214
 	/**
215 215
 	 * Sets the main threshold level.
216
-	 * @param Payone_Log4php_LoggerLevel $l
217 216
 	 */
218 217
 	public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219 218
 		$this->threshold = $threshold;
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -49,192 +49,192 @@
 block discarded – undo
49 49
  */
50 50
 class Payone_Log4php_LoggerHierarchy {
51 51
 	
52
-	/** Array holding all Logger instances. */
53
-	protected $loggers = array();
52
+    /** Array holding all Logger instances. */
53
+    protected $loggers = array();
54 54
 	
55
-	/** 
56
-	 * The root logger.
57
-	 * @var RootLogger 
58
-	 */
59
-	protected $root = null;
55
+    /** 
56
+     * The root logger.
57
+     * @var RootLogger 
58
+     */
59
+    protected $root = null;
60 60
 	
61
-	/** 
62
-	 * The logger renderer map.
63
-	 * @var Payone_Log4php_LoggerRendererMap
64
-	 */
65
-	protected $rendererMap;
61
+    /** 
62
+     * The logger renderer map.
63
+     * @var Payone_Log4php_LoggerRendererMap
64
+     */
65
+    protected $rendererMap;
66 66
 
67
-	/** 
68
-	 * Main level threshold. Events with lower level will not be logged by any 
69
-	 * logger, regardless of it's configuration.
70
-	 * @var Payone_Log4php_LoggerLevel
71
-	 */
72
-	protected $threshold;
67
+    /** 
68
+     * Main level threshold. Events with lower level will not be logged by any 
69
+     * logger, regardless of it's configuration.
70
+     * @var Payone_Log4php_LoggerLevel
71
+     */
72
+    protected $threshold;
73 73
 	
74
-	/**
75
-	 * Creates a new logger hierarchy.
76
-	 * @param Payone_Log4php_LoggerRoot $root The root logger.
77
-	 */
78
-	public function __construct(Payone_Log4php_LoggerRoot $root) {
79
-		$this->root = $root;
80
-		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
81
-		$this->rendererMap = new Payone_Log4php_LoggerRendererMap();
82
-	}
74
+    /**
75
+     * Creates a new logger hierarchy.
76
+     * @param Payone_Log4php_LoggerRoot $root The root logger.
77
+     */
78
+    public function __construct(Payone_Log4php_LoggerRoot $root) {
79
+        $this->root = $root;
80
+        $this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
81
+        $this->rendererMap = new Payone_Log4php_LoggerRendererMap();
82
+    }
83 83
 	 
84
-	/**
85
-	 * Clears all loggers.
86
-	 */
87
-	public function clear() {
88
-		$this->loggers = array();
89
-	}
84
+    /**
85
+     * Clears all loggers.
86
+     */
87
+    public function clear() {
88
+        $this->loggers = array();
89
+    }
90 90
 	
91
-	/**
92
-	 * Check if the named logger exists in the hierarchy.
93
-	 * @param string $name
94
-	 * @return boolean
95
-	 */
96
-	public function exists($name) {
97
-		return isset($this->loggers[$name]);
98
-	}
91
+    /**
92
+     * Check if the named logger exists in the hierarchy.
93
+     * @param string $name
94
+     * @return boolean
95
+     */
96
+    public function exists($name) {
97
+        return isset($this->loggers[$name]);
98
+    }
99 99
 
100
-	/**
101
-	 * Returns all the currently defined loggers in this hierarchy as an array.
102
-	 * @return array
103
-	 */	 
104
-	public function getCurrentLoggers() {
105
-		return array_values($this->loggers);
106
-	}
100
+    /**
101
+     * Returns all the currently defined loggers in this hierarchy as an array.
102
+     * @return array
103
+     */	 
104
+    public function getCurrentLoggers() {
105
+        return array_values($this->loggers);
106
+    }
107 107
 	
108
-	/**
109
-	 * Returns a named logger instance logger. If it doesn't exist, one is created.
110
-	 * 
111
-	 * @param string $name Logger name
112
-	 * @return Logger Logger instance.
113
-	 */
114
-	public function getLogger($name) {
115
-		if(!isset($this->loggers[$name])) {
116
-			$logger = new Payone_Log4php_Logger($name);
108
+    /**
109
+     * Returns a named logger instance logger. If it doesn't exist, one is created.
110
+     * 
111
+     * @param string $name Logger name
112
+     * @return Logger Logger instance.
113
+     */
114
+    public function getLogger($name) {
115
+        if(!isset($this->loggers[$name])) {
116
+            $logger = new Payone_Log4php_Logger($name);
117 117
 
118
-			$nodes = explode('.', $name);
119
-			$firstNode = array_shift($nodes);
118
+            $nodes = explode('.', $name);
119
+            $firstNode = array_shift($nodes);
120 120
 			
121
-			// if name is not a first node but another first node is their
122
-			if($firstNode != $name and isset($this->loggers[$firstNode])) {
123
-				$logger->setParent($this->loggers[$firstNode]);
124
-			} else {
125
-				// if there is no father, set root logger as father
126
-				$logger->setParent($this->root);
127
-			} 
121
+            // if name is not a first node but another first node is their
122
+            if($firstNode != $name and isset($this->loggers[$firstNode])) {
123
+                $logger->setParent($this->loggers[$firstNode]);
124
+            } else {
125
+                // if there is no father, set root logger as father
126
+                $logger->setParent($this->root);
127
+            } 
128 128
 		
129
-			// if there are more nodes than one
130
-			if(count($nodes) > 0) {
131
-				// find parent node
132
-				foreach($nodes as $node) {
133
-					$parentNode = "$firstNode.$node";
134
-					if(isset($this->loggers[$parentNode]) and $parentNode != $name) {
135
-						$logger->setParent($this->loggers[$parentNode]);
136
-					}
137
-					$firstNode .= ".$node";
138
-				}
139
-			}
129
+            // if there are more nodes than one
130
+            if(count($nodes) > 0) {
131
+                // find parent node
132
+                foreach($nodes as $node) {
133
+                    $parentNode = "$firstNode.$node";
134
+                    if(isset($this->loggers[$parentNode]) and $parentNode != $name) {
135
+                        $logger->setParent($this->loggers[$parentNode]);
136
+                    }
137
+                    $firstNode .= ".$node";
138
+                }
139
+            }
140 140
 			
141
-			$this->loggers[$name] = $logger;
142
-		}		
141
+            $this->loggers[$name] = $logger;
142
+        }		
143 143
 		
144
-		return $this->loggers[$name];
145
-	} 
144
+        return $this->loggers[$name];
145
+    } 
146 146
 	
147
-	/**
148
-	 * Returns the logger renderer map.
149
-	 * @return Payone_Log4php_LoggerRendererMap
150
-	 */
151
-	public function getRendererMap() {
152
-		return $this->rendererMap;
153
-	}
147
+    /**
148
+     * Returns the logger renderer map.
149
+     * @return Payone_Log4php_LoggerRendererMap
150
+     */
151
+    public function getRendererMap() {
152
+        return $this->rendererMap;
153
+    }
154 154
 	
155
-	/**
156
-	 * Returns the root logger.
157
-	 * @return Payone_Log4php_LoggerRoot
158
-	 */ 
159
-	public function getRootLogger() {
160
-		if(!isset($this->root) or $this->root == null) {
161
-			$this->root = new Payone_Log4php_LoggerRoot();
162
-		}
163
-		return $this->root;
164
-	}
155
+    /**
156
+     * Returns the root logger.
157
+     * @return Payone_Log4php_LoggerRoot
158
+     */ 
159
+    public function getRootLogger() {
160
+        if(!isset($this->root) or $this->root == null) {
161
+            $this->root = new Payone_Log4php_LoggerRoot();
162
+        }
163
+        return $this->root;
164
+    }
165 165
 	 
166
-	/**
167
-	 * Returns the main threshold level.
168
-	 * @return Payone_Log4php_LoggerLevel
169
-	 */
170
-	public function getThreshold() {
171
-		return $this->threshold;
172
-	} 
166
+    /**
167
+     * Returns the main threshold level.
168
+     * @return Payone_Log4php_LoggerLevel
169
+     */
170
+    public function getThreshold() {
171
+        return $this->threshold;
172
+    } 
173 173
 
174
-	/**
175
-	 * Returns true if the hierarchy is disabled for given log level and false
176
-	 * otherwise.
177
-	 * @return boolean
178
-	 */
179
-	public function isDisabled(Payone_Log4php_LoggerLevel $level) {
180
-		return ($this->threshold->toInt() > $level->toInt());
181
-	}
174
+    /**
175
+     * Returns true if the hierarchy is disabled for given log level and false
176
+     * otherwise.
177
+     * @return boolean
178
+     */
179
+    public function isDisabled(Payone_Log4php_LoggerLevel $level) {
180
+        return ($this->threshold->toInt() > $level->toInt());
181
+    }
182 182
 	
183
-	/**
184
-	 * Reset all values contained in this hierarchy instance to their
185
-	 * default. 
186
-	 *
187
-	 * This removes all appenders from all loggers, sets
188
-	 * the level of all non-root loggers to <i>null</i>,
189
-	 * sets their additivity flag to <i>true</i> and sets the level
190
-	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
191
-	 * 
192
-	 * <p>Existing loggers are not removed. They are just reset.
193
-	 *
194
-	 * <p>This method should be used sparingly and with care as it will
195
-	 * block all logging until it is completed.</p>
196
-	 */
197
-	public function resetConfiguration() {
198
-		$root = $this->getRootLogger();
183
+    /**
184
+     * Reset all values contained in this hierarchy instance to their
185
+     * default. 
186
+     *
187
+     * This removes all appenders from all loggers, sets
188
+     * the level of all non-root loggers to <i>null</i>,
189
+     * sets their additivity flag to <i>true</i> and sets the level
190
+     * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
191
+     * 
192
+     * <p>Existing loggers are not removed. They are just reset.
193
+     *
194
+     * <p>This method should be used sparingly and with care as it will
195
+     * block all logging until it is completed.</p>
196
+     */
197
+    public function resetConfiguration() {
198
+        $root = $this->getRootLogger();
199 199
 		
200
-		$root->setLevel(Payone_Log4php_LoggerLevel::getLevelDebug());
201
-		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202
-		$this->shutDown();
200
+        $root->setLevel(Payone_Log4php_LoggerLevel::getLevelDebug());
201
+        $this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202
+        $this->shutDown();
203 203
 		
204
-		foreach($this->loggers as $logger) {
205
-			$logger->setLevel(null);
206
-			$logger->setAdditivity(true);
207
-			$logger->removeAllAppenders();
208
-		}
204
+        foreach($this->loggers as $logger) {
205
+            $logger->setLevel(null);
206
+            $logger->setAdditivity(true);
207
+            $logger->removeAllAppenders();
208
+        }
209 209
 		
210
-		$this->rendererMap->clear();
211
-		Payone_Log4php_LoggerAppenderPool::clear();
212
-	}
210
+        $this->rendererMap->clear();
211
+        Payone_Log4php_LoggerAppenderPool::clear();
212
+    }
213 213
 	
214
-	/**
215
-	 * Sets the main threshold level.
216
-	 * @param Payone_Log4php_LoggerLevel $l
217
-	 */
218
-	public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219
-		$this->threshold = $threshold;
220
-	}
214
+    /**
215
+     * Sets the main threshold level.
216
+     * @param Payone_Log4php_LoggerLevel $l
217
+     */
218
+    public function setThreshold(Payone_Log4php_LoggerLevel $threshold) {
219
+        $this->threshold = $threshold;
220
+    }
221 221
 	
222
-	/**
223
-	 * Shutting down a hierarchy will <i>safely</i> close and remove
224
-	 * all appenders in all loggers including the root logger.
225
-	 * 
226
-	 * The shutdown method is careful to close nested
227
-	 * appenders before closing regular appenders. This is allows
228
-	 * configurations where a regular appender is attached to a logger
229
-	 * and again to a nested appender.
230
-	 * 
231
-	 * @todo Check if the last paragraph is correct.
232
-	 */
233
-	public function shutdown() {
234
-		$this->root->removeAllAppenders();
222
+    /**
223
+     * Shutting down a hierarchy will <i>safely</i> close and remove
224
+     * all appenders in all loggers including the root logger.
225
+     * 
226
+     * The shutdown method is careful to close nested
227
+     * appenders before closing regular appenders. This is allows
228
+     * configurations where a regular appender is attached to a logger
229
+     * and again to a nested appender.
230
+     * 
231
+     * @todo Check if the last paragraph is correct.
232
+     */
233
+    public function shutdown() {
234
+        $this->root->removeAllAppenders();
235 235
 		
236
-		foreach($this->loggers as $logger) {
237
-			$logger->removeAllAppenders();
238
-		}
239
-	}
236
+        foreach($this->loggers as $logger) {
237
+            $logger->removeAllAppenders();
238
+        }
239
+    }
240 240
 } 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	 * @return Logger Logger instance.
113 113
 	 */
114 114
 	public function getLogger($name) {
115
-		if(!isset($this->loggers[$name])) {
115
+		if (!isset($this->loggers[$name])) {
116 116
 			$logger = new Payone_Log4php_Logger($name);
117 117
 
118 118
 			$nodes = explode('.', $name);
119 119
 			$firstNode = array_shift($nodes);
120 120
 			
121 121
 			// if name is not a first node but another first node is their
122
-			if($firstNode != $name and isset($this->loggers[$firstNode])) {
122
+			if ($firstNode != $name and isset($this->loggers[$firstNode])) {
123 123
 				$logger->setParent($this->loggers[$firstNode]);
124 124
 			} else {
125 125
 				// if there is no father, set root logger as father
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 			} 
128 128
 		
129 129
 			// if there are more nodes than one
130
-			if(count($nodes) > 0) {
130
+			if (count($nodes) > 0) {
131 131
 				// find parent node
132
-				foreach($nodes as $node) {
132
+				foreach ($nodes as $node) {
133 133
 					$parentNode = "$firstNode.$node";
134
-					if(isset($this->loggers[$parentNode]) and $parentNode != $name) {
134
+					if (isset($this->loggers[$parentNode]) and $parentNode != $name) {
135 135
 						$logger->setParent($this->loggers[$parentNode]);
136 136
 					}
137 137
 					$firstNode .= ".$node";
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Payone_Log4php_LoggerRoot
158 158
 	 */ 
159 159
 	public function getRootLogger() {
160
-		if(!isset($this->root) or $this->root == null) {
160
+		if (!isset($this->root) or $this->root == null) {
161 161
 			$this->root = new Payone_Log4php_LoggerRoot();
162 162
 		}
163 163
 		return $this->root;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		$this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll());
202 202
 		$this->shutDown();
203 203
 		
204
-		foreach($this->loggers as $logger) {
204
+		foreach ($this->loggers as $logger) {
205 205
 			$logger->setLevel(null);
206 206
 			$logger->setAdditivity(true);
207 207
 			$logger->removeAllAppenders();
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	public function shutdown() {
234 234
 		$this->root->removeAllAppenders();
235 235
 		
236
-		foreach($this->loggers as $logger) {
236
+		foreach ($this->loggers as $logger) {
237 237
 			$logger->removeAllAppenders();
238 238
 		}
239 239
 	}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLevel.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Compares two logger levels.
75 75
 	 *
76
-	 * @param LoggerLevels $other
77
-	 * @return boolean 
76
+	 * @param Payone_Log4php_LoggerLevel $other
77
+	 * @return boolean|null 
78 78
 	 */
79 79
 	public function equals($other) {
80 80
 		if($other instanceof Payone_Log4php_LoggerLevel) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * this method returns the provided default level.
224 224
 	 *
225 225
 	 * @param mixed $arg The value to convert to level.
226
-	 * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
226
+	 * @param Payone_Log4php_LoggerLevel $defaultLevel Value to return if conversion is not possible.
227 227
 	 * @return Payone_Log4php_LoggerLevel
228 228
 	 */
229 229
 	public static function toLevel($arg, $defaultLevel = null) {
Please login to merge, or discard this patch.
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -33,224 +33,224 @@
 block discarded – undo
33 33
  */
34 34
 class Payone_Log4php_LoggerLevel {
35 35
 	
36
-	const OFF = 2147483647;
37
-	const FATAL = 50000;
38
-	const ERROR = 40000;
39
-	const WARN = 30000;
40
-	const INFO = 20000;
41
-	const DEBUG = 10000;
42
-	const TRACE = 5000;
43
-	const ALL = -2147483647;
36
+    const OFF = 2147483647;
37
+    const FATAL = 50000;
38
+    const ERROR = 40000;
39
+    const WARN = 30000;
40
+    const INFO = 20000;
41
+    const DEBUG = 10000;
42
+    const TRACE = 5000;
43
+    const ALL = -2147483647;
44 44
 
45
-	/** Integer level value. */
46
-	private $level;
45
+    /** Integer level value. */
46
+    private $level;
47 47
 	
48
-	/** Contains a list of instantiated levels. */
49
-	private static $levelMap;
48
+    /** Contains a list of instantiated levels. */
49
+    private static $levelMap;
50 50
 
51
-	/** String representation of the level. */
52
-	private $levelStr;
51
+    /** String representation of the level. */
52
+    private $levelStr;
53 53
 
54
-	/** 
55
-	 * Equivalent syslog level.
56
-	 * @var integer
57
-	 */
58
-	private $syslogEquivalent;
54
+    /** 
55
+     * Equivalent syslog level.
56
+     * @var integer
57
+     */
58
+    private $syslogEquivalent;
59 59
 
60
-	/**
61
-	 * Constructor
62
-	 *
63
-	 * @param integer $level
64
-	 * @param string $levelStr
65
-	 * @param integer $syslogEquivalent
66
-	 */
67
-	private function __construct($level, $levelStr, $syslogEquivalent) {
68
-		$this->level = $level;
69
-		$this->levelStr = $levelStr;
70
-		$this->syslogEquivalent = $syslogEquivalent;
71
-	}
60
+    /**
61
+     * Constructor
62
+     *
63
+     * @param integer $level
64
+     * @param string $levelStr
65
+     * @param integer $syslogEquivalent
66
+     */
67
+    private function __construct($level, $levelStr, $syslogEquivalent) {
68
+        $this->level = $level;
69
+        $this->levelStr = $levelStr;
70
+        $this->syslogEquivalent = $syslogEquivalent;
71
+    }
72 72
 
73
-	/**
74
-	 * Compares two logger levels.
75
-	 *
76
-	 * @param LoggerLevels $other
77
-	 * @return boolean 
78
-	 */
79
-	public function equals($other) {
80
-		if($other instanceof Payone_Log4php_LoggerLevel) {
81
-			if($this->level == $other->level) {
82
-				return true;
83
-			}
84
-		} else {
85
-			return false;
86
-		}
87
-	}
73
+    /**
74
+     * Compares two logger levels.
75
+     *
76
+     * @param LoggerLevels $other
77
+     * @return boolean 
78
+     */
79
+    public function equals($other) {
80
+        if($other instanceof Payone_Log4php_LoggerLevel) {
81
+            if($this->level == $other->level) {
82
+                return true;
83
+            }
84
+        } else {
85
+            return false;
86
+        }
87
+    }
88 88
 	
89
-	/**
90
-	 * Returns an Off Level
91
-	 * @return Payone_Log4php_LoggerLevel
92
-	 */
93
-	public static function getLevelOff() {
94
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95
-			self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96
-		}
97
-		return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
98
-	}
89
+    /**
90
+     * Returns an Off Level
91
+     * @return Payone_Log4php_LoggerLevel
92
+     */
93
+    public static function getLevelOff() {
94
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95
+            self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96
+        }
97
+        return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
98
+    }
99 99
 
100
-	/**
101
-	 * Returns a Fatal Level
102
-	 * @return Payone_Log4php_LoggerLevel
103
-	 */
104
-	public static function getLevelFatal() {
105
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106
-			self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107
-		}
108
-		return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
109
-	}
100
+    /**
101
+     * Returns a Fatal Level
102
+     * @return Payone_Log4php_LoggerLevel
103
+     */
104
+    public static function getLevelFatal() {
105
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106
+            self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107
+        }
108
+        return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
109
+    }
110 110
 	
111
-	/**
112
-	 * Returns an Error Level
113
-	 * @return Payone_Log4php_LoggerLevel
114
-	 */
115
-	public static function getLevelError() {
116
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117
-			self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118
-		}
119
-		return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
120
-	}
111
+    /**
112
+     * Returns an Error Level
113
+     * @return Payone_Log4php_LoggerLevel
114
+     */
115
+    public static function getLevelError() {
116
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117
+            self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118
+        }
119
+        return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
120
+    }
121 121
 	
122
-	/**
123
-	 * Returns a Warn Level
124
-	 * @return Payone_Log4php_LoggerLevel
125
-	 */
126
-	public static function getLevelWarn() {
127
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128
-			self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129
-		}
130
-		return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
131
-	}
122
+    /**
123
+     * Returns a Warn Level
124
+     * @return Payone_Log4php_LoggerLevel
125
+     */
126
+    public static function getLevelWarn() {
127
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128
+            self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129
+        }
130
+        return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
131
+    }
132 132
 
133
-	/**
134
-	 * Returns an Info Level
135
-	 * @return Payone_Log4php_LoggerLevel
136
-	 */
137
-	public static function getLevelInfo() {
138
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139
-			self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140
-		}
141
-		return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
142
-	}
133
+    /**
134
+     * Returns an Info Level
135
+     * @return Payone_Log4php_LoggerLevel
136
+     */
137
+    public static function getLevelInfo() {
138
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139
+            self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140
+        }
141
+        return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
142
+    }
143 143
 
144
-	/**
145
-	 * Returns a Debug Level
146
-	 * @return Payone_Log4php_LoggerLevel
147
-	 */
148
-	public static function getLevelDebug() {
149
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150
-			self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151
-		}
152
-		return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
153
-	}
144
+    /**
145
+     * Returns a Debug Level
146
+     * @return Payone_Log4php_LoggerLevel
147
+     */
148
+    public static function getLevelDebug() {
149
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150
+            self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151
+        }
152
+        return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
153
+    }
154 154
 	
155
-	/**
156
-	 * Returns a Trace Level
157
-	 * @return Payone_Log4php_LoggerLevel
158
-	 */
159
-	public static function getLevelTrace() {
160
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161
-			self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162
-		}
163
-		return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
164
-	}	
155
+    /**
156
+     * Returns a Trace Level
157
+     * @return Payone_Log4php_LoggerLevel
158
+     */
159
+    public static function getLevelTrace() {
160
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161
+            self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162
+        }
163
+        return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
164
+    }	
165 165
 
166
-	/**
167
-	 * Returns an All Level
168
-	 * @return Payone_Log4php_LoggerLevel
169
-	 */
170
-	public static function getLevelAll() {
171
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172
-			self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173
-		}
174
-		return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
175
-	}
166
+    /**
167
+     * Returns an All Level
168
+     * @return Payone_Log4php_LoggerLevel
169
+     */
170
+    public static function getLevelAll() {
171
+        if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172
+            self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173
+        }
174
+        return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
175
+    }
176 176
 	
177
-	/**
178
-	 * Return the syslog equivalent of this priority as an integer.
179
-	 * @return integer
180
-	 */
181
-	public function getSyslogEquivalent() {
182
-		return $this->syslogEquivalent;
183
-	}
177
+    /**
178
+     * Return the syslog equivalent of this priority as an integer.
179
+     * @return integer
180
+     */
181
+    public function getSyslogEquivalent() {
182
+        return $this->syslogEquivalent;
183
+    }
184 184
 
185
-	/**
186
-	 * Returns <i>true</i> if this level has a higher or equal
187
-	 * level than the level passed as argument, <i>false</i>
188
-	 * otherwise.
189
-	 *
190
-	 * @param Payone_Log4php_LoggerLevel $other
191
-	 * @return boolean
192
-	 */
193
-	public function isGreaterOrEqual($other) {
194
-		return $this->level >= $other->level;
195
-	}
185
+    /**
186
+     * Returns <i>true</i> if this level has a higher or equal
187
+     * level than the level passed as argument, <i>false</i>
188
+     * otherwise.
189
+     *
190
+     * @param Payone_Log4php_LoggerLevel $other
191
+     * @return boolean
192
+     */
193
+    public function isGreaterOrEqual($other) {
194
+        return $this->level >= $other->level;
195
+    }
196 196
 
197
-	/**
198
-	 * Returns the string representation of this level.
199
-	 * @return string
200
-	 */
201
-	public function toString() {
202
-		return $this->levelStr;
203
-	}
197
+    /**
198
+     * Returns the string representation of this level.
199
+     * @return string
200
+     */
201
+    public function toString() {
202
+        return $this->levelStr;
203
+    }
204 204
 	
205
-	/**
206
-	 * Returns the string representation of this level.
207
-	 * @return string
208
-	 */
209
-	public function __toString() {
210
-		return $this->toString();
211
-	}
205
+    /**
206
+     * Returns the string representation of this level.
207
+     * @return string
208
+     */
209
+    public function __toString() {
210
+        return $this->toString();
211
+    }
212 212
 
213
-	/**
214
-	 * Returns the integer representation of this level.
215
-	 * @return integer
216
-	 */
217
-	public function toInt() {
218
-		return $this->level;
219
-	}
213
+    /**
214
+     * Returns the integer representation of this level.
215
+     * @return integer
216
+     */
217
+    public function toInt() {
218
+        return $this->level;
219
+    }
220 220
 
221
-	/**
222
-	 * Convert the input argument to a level. If the conversion fails, then 
223
-	 * this method returns the provided default level.
224
-	 *
225
-	 * @param mixed $arg The value to convert to level.
226
-	 * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
227
-	 * @return Payone_Log4php_LoggerLevel
228
-	 */
229
-	public static function toLevel($arg, $defaultLevel = null) {
230
-		if(is_int($arg)) {
231
-			switch($arg) {
232
-				case self::ALL:	return self::getLevelAll();
233
-				case self::TRACE: return self::getLevelTrace();
234
-				case self::DEBUG: return self::getLevelDebug();
235
-				case self::INFO: return self::getLevelInfo();
236
-				case self::WARN: return self::getLevelWarn();
237
-				case self::ERROR: return self::getLevelError();
238
-				case self::FATAL: return self::getLevelFatal();
239
-				case self::OFF:	return self::getLevelOff();
240
-				default: return $defaultLevel;
241
-			}
242
-		} else {
243
-			switch(strtoupper($arg)) {
244
-				case 'ALL':	return self::getLevelAll();
245
-				case 'TRACE': return self::getLevelTrace();
246
-				case 'DEBUG': return self::getLevelDebug();
247
-				case 'INFO': return self::getLevelInfo();
248
-				case 'WARN': return self::getLevelWarn();
249
-				case 'ERROR': return self::getLevelError();
250
-				case 'FATAL': return self::getLevelFatal();
251
-				case 'OFF':	return self::getLevelOff();
252
-				default: return $defaultLevel;
253
-			}
254
-		}
255
-	}
221
+    /**
222
+     * Convert the input argument to a level. If the conversion fails, then 
223
+     * this method returns the provided default level.
224
+     *
225
+     * @param mixed $arg The value to convert to level.
226
+     * @param Payone_Log4php_LoggerLevel $default Value to return if conversion is not possible.
227
+     * @return Payone_Log4php_LoggerLevel
228
+     */
229
+    public static function toLevel($arg, $defaultLevel = null) {
230
+        if(is_int($arg)) {
231
+            switch($arg) {
232
+                case self::ALL:	return self::getLevelAll();
233
+                case self::TRACE: return self::getLevelTrace();
234
+                case self::DEBUG: return self::getLevelDebug();
235
+                case self::INFO: return self::getLevelInfo();
236
+                case self::WARN: return self::getLevelWarn();
237
+                case self::ERROR: return self::getLevelError();
238
+                case self::FATAL: return self::getLevelFatal();
239
+                case self::OFF:	return self::getLevelOff();
240
+                default: return $defaultLevel;
241
+            }
242
+        } else {
243
+            switch(strtoupper($arg)) {
244
+                case 'ALL':	return self::getLevelAll();
245
+                case 'TRACE': return self::getLevelTrace();
246
+                case 'DEBUG': return self::getLevelDebug();
247
+                case 'INFO': return self::getLevelInfo();
248
+                case 'WARN': return self::getLevelWarn();
249
+                case 'ERROR': return self::getLevelError();
250
+                case 'FATAL': return self::getLevelFatal();
251
+                case 'OFF':	return self::getLevelOff();
252
+                default: return $defaultLevel;
253
+            }
254
+        }
255
+    }
256 256
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @return boolean 
78 78
 	 */
79 79
 	public function equals($other) {
80
-		if($other instanceof Payone_Log4php_LoggerLevel) {
81
-			if($this->level == $other->level) {
80
+		if ($other instanceof Payone_Log4php_LoggerLevel) {
81
+			if ($this->level == $other->level) {
82 82
 				return true;
83 83
 			}
84 84
 		} else {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return Payone_Log4php_LoggerLevel
92 92
 	 */
93 93
 	public static function getLevelOff() {
94
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
94
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::OFF])) {
95 95
 			self::$levelMap[Payone_Log4php_LoggerLevel::OFF] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::OFF, 'OFF', LOG_ALERT);
96 96
 		}
97 97
 		return self::$levelMap[Payone_Log4php_LoggerLevel::OFF];
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return Payone_Log4php_LoggerLevel
103 103
 	 */
104 104
 	public static function getLevelFatal() {
105
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
105
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::FATAL])) {
106 106
 			self::$levelMap[Payone_Log4php_LoggerLevel::FATAL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
107 107
 		}
108 108
 		return self::$levelMap[Payone_Log4php_LoggerLevel::FATAL];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return Payone_Log4php_LoggerLevel
114 114
 	 */
115 115
 	public static function getLevelError() {
116
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
116
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ERROR])) {
117 117
 			self::$levelMap[Payone_Log4php_LoggerLevel::ERROR] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ERROR, 'ERROR', LOG_ERR);
118 118
 		}
119 119
 		return self::$levelMap[Payone_Log4php_LoggerLevel::ERROR];
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return Payone_Log4php_LoggerLevel
125 125
 	 */
126 126
 	public static function getLevelWarn() {
127
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
127
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::WARN])) {
128 128
 			self::$levelMap[Payone_Log4php_LoggerLevel::WARN] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::WARN, 'WARN', LOG_WARNING);
129 129
 		}
130 130
 		return self::$levelMap[Payone_Log4php_LoggerLevel::WARN];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return Payone_Log4php_LoggerLevel
136 136
 	 */
137 137
 	public static function getLevelInfo() {
138
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
138
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::INFO])) {
139 139
 			self::$levelMap[Payone_Log4php_LoggerLevel::INFO] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::INFO, 'INFO', LOG_INFO);
140 140
 		}
141 141
 		return self::$levelMap[Payone_Log4php_LoggerLevel::INFO];
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return Payone_Log4php_LoggerLevel
147 147
 	 */
148 148
 	public static function getLevelDebug() {
149
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
149
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG])) {
150 150
 			self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
151 151
 		}
152 152
 		return self::$levelMap[Payone_Log4php_LoggerLevel::DEBUG];
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Payone_Log4php_LoggerLevel
158 158
 	 */
159 159
 	public static function getLevelTrace() {
160
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
160
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::TRACE])) {
161 161
 			self::$levelMap[Payone_Log4php_LoggerLevel::TRACE] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
162 162
 		}
163 163
 		return self::$levelMap[Payone_Log4php_LoggerLevel::TRACE];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return Payone_Log4php_LoggerLevel
169 169
 	 */
170 170
 	public static function getLevelAll() {
171
-		if(!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
171
+		if (!isset(self::$levelMap[Payone_Log4php_LoggerLevel::ALL])) {
172 172
 			self::$levelMap[Payone_Log4php_LoggerLevel::ALL] = new Payone_Log4php_LoggerLevel(Payone_Log4php_LoggerLevel::ALL, 'ALL', LOG_DEBUG);
173 173
 		}
174 174
 		return self::$levelMap[Payone_Log4php_LoggerLevel::ALL];
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * @return Payone_Log4php_LoggerLevel
228 228
 	 */
229 229
 	public static function toLevel($arg, $defaultLevel = null) {
230
-		if(is_int($arg)) {
231
-			switch($arg) {
230
+		if (is_int($arg)) {
231
+			switch ($arg) {
232 232
 				case self::ALL:	return self::getLevelAll();
233 233
 				case self::TRACE: return self::getLevelTrace();
234 234
 				case self::DEBUG: return self::getLevelDebug();
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				default: return $defaultLevel;
241 241
 			}
242 242
 		} else {
243
-			switch(strtoupper($arg)) {
243
+			switch (strtoupper($arg)) {
244 244
 				case 'ALL':	return self::getLevelAll();
245 245
 				case 'TRACE': return self::getLevelTrace();
246 246
 				case 'DEBUG': return self::getLevelDebug();
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLocationInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63 63
 	 *
64 64
 	 * @param array $trace
65
-	 * @param mixed $caller
65
+	 * @param string $fqcn
66 66
 	 */
67 67
 	public function __construct($trace, $fqcn = null) {
68 68
 		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -26,85 +26,85 @@
 block discarded – undo
26 26
  * @since 0.3
27 27
  */
28 28
 class Payone_Log4php_LoggerLocationInfo {
29
-	/**
30
-	 * When location information is not available the constant
31
-	 * <i>NA</i> is returned. Current value of this string
32
-	 * constant is <b>?</b>.  
33
-	 */
34
-	const LOCATION_INFO_NA = 'NA';
29
+    /**
30
+     * When location information is not available the constant
31
+     * <i>NA</i> is returned. Current value of this string
32
+     * constant is <b>?</b>.  
33
+     */
34
+    const LOCATION_INFO_NA = 'NA';
35 35
 	
36
-	/**
37
-	* @var string Caller's line number.
38
-	*/
39
-	protected $lineNumber = null;
36
+    /**
37
+     * @var string Caller's line number.
38
+     */
39
+    protected $lineNumber = null;
40 40
 	
41
-	/**
42
-	* @var string Caller's file name.
43
-	*/
44
-	protected $fileName = null;
41
+    /**
42
+     * @var string Caller's file name.
43
+     */
44
+    protected $fileName = null;
45 45
 	
46
-	/**
47
-	* @var string Caller's fully qualified class name.
48
-	*/
49
-	protected $className = null;
46
+    /**
47
+     * @var string Caller's fully qualified class name.
48
+     */
49
+    protected $className = null;
50 50
 	
51
-	/**
52
-	* @var string Caller's method name.
53
-	*/
54
-	protected $methodName = null;
51
+    /**
52
+     * @var string Caller's method name.
53
+     */
54
+    protected $methodName = null;
55 55
 	
56
-	/**
57
-	* @var string 
58
-	*/
59
-	protected $fullInfo = null;
56
+    /**
57
+     * @var string 
58
+     */
59
+    protected $fullInfo = null;
60 60
 
61
-	/**
62
-	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
-	 *
64
-	 * @param array $trace
65
-	 * @param mixed $caller
66
-	 */
67
-	public function __construct($trace, $fqcn = null) {
68
-		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
-		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
-		$this->className = isset($trace['class']) ? $trace['class'] : null;
71
-		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
-		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
-			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
-	}
61
+    /**
62
+     * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
63
+     *
64
+     * @param array $trace
65
+     * @param mixed $caller
66
+     */
67
+    public function __construct($trace, $fqcn = null) {
68
+        $this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
69
+        $this->fileName = isset($trace['file']) ? $trace['file'] : null;
70
+        $this->className = isset($trace['class']) ? $trace['class'] : null;
71
+        $this->methodName = isset($trace['function']) ? $trace['function'] : null;
72
+        $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
73
+            '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
74
+    }
75 75
 
76
-	public function getClassName() {
77
-		return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
-	}
76
+    public function getClassName() {
77
+        return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
78
+    }
79 79
 
80
-	/**
81
-	 *	Return the file name of the caller.
82
-	 *	<p>This information is not always available.
83
-	 */
84
-	public function getFileName() {
85
-		return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
-	}
80
+    /**
81
+     *	Return the file name of the caller.
82
+     *	<p>This information is not always available.
83
+     */
84
+    public function getFileName() {
85
+        return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
86
+    }
87 87
 
88
-	/**
89
-	 *	Returns the line number of the caller.
90
-	 *	<p>This information is not always available.
91
-	 */
92
-	public function getLineNumber() {
93
-		return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
-	}
88
+    /**
89
+     *	Returns the line number of the caller.
90
+     *	<p>This information is not always available.
91
+     */
92
+    public function getLineNumber() {
93
+        return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
94
+    }
95 95
 
96
-	/**
97
-	 *	Returns the method name of the caller.
98
-	 */
99
-	public function getMethodName() {
100
-		return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
-	}
96
+    /**
97
+     *	Returns the method name of the caller.
98
+     */
99
+    public function getMethodName() {
100
+        return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
101
+    }
102 102
 
103
-	/**
104
-	 *	Returns the full information of the caller.
105
-	 */
106
-	public function getFullInfo() {
107
-		return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
-	}
103
+    /**
104
+     *	Returns the full information of the caller.
105
+     */
106
+    public function getFullInfo() {
107
+        return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
108
+    }
109 109
 
110 110
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerLoggingEvent.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	* LoggerLoggingEvent are filled when actually needed.
120 120
 	*
121 121
 	* @param string $fqcn name of the caller class.
122
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
122
+	* @param Payone_Log4php_Logger $logger The {@link Logger} category of this event or the logger name.
123 123
 	* @param Payone_Log4php_LoggerLevel $priority The level of this event.
124 124
 	* @param mixed $message The message of this event.
125 125
 	* @param integer $timeStamp the timestamp of this logging event.
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	
315 315
 	/**
316 316
 	 * Calculates the time of this event.
317
-	 * @return the time after event starttime when this event has occured
317
+	 * @return string time after event starttime when this event has occured
318 318
 	 */
319 319
 	public function getTime() {
320 320
 		$eventTime = $this->getTimeStamp();
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	/**
336
-	 * @return mixed LoggerThrowableInformation
336
+	 * @return Payone_Log4php_LoggerThrowableInformation LoggerThrowableInformation
337 337
 	 */
338 338
 	public function getThrowableInformation() {
339 339
 		return $this->throwableInfo;
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -26,344 +26,344 @@
 block discarded – undo
26 26
  */
27 27
 class Payone_Log4php_LoggerLoggingEvent {
28 28
 
29
-	private static $startTime;
29
+    private static $startTime;
30 30
 
31
-	/** 
32
-	* @var string Fully Qualified Class Name of the calling category class.
33
-	*/
34
-	private $fqcn;
31
+    /** 
32
+     * @var string Fully Qualified Class Name of the calling category class.
33
+     */
34
+    private $fqcn;
35 35
 	
36
-	/**
37
-	* @var Logger reference
38
-	*/
39
-	private $logger = null;
36
+    /**
37
+     * @var Logger reference
38
+     */
39
+    private $logger = null;
40 40
 	
41
-	/** 
42
-	 * The category (logger) name.
43
-	 * This field will be marked as private in future
44
-	 * releases. Please do not access it directly. 
45
-	 * Use the {@link getLoggerName()} method instead.
46
-	 * @deprecated 
47
-	 */
48
-	private $categoryName;
41
+    /** 
42
+     * The category (logger) name.
43
+     * This field will be marked as private in future
44
+     * releases. Please do not access it directly. 
45
+     * Use the {@link getLoggerName()} method instead.
46
+     * @deprecated 
47
+     */
48
+    private $categoryName;
49 49
 	
50
-	/** 
51
-	 * Level of the logging event.
52
-	 * @var Payone_Log4php_LoggerLevel
53
-	 */
54
-	protected $level;
50
+    /** 
51
+     * Level of the logging event.
52
+     * @var Payone_Log4php_LoggerLevel
53
+     */
54
+    protected $level;
55 55
 	
56
-	/** 
57
-	 * The nested diagnostic context (NDC) of logging event.
58
-	 * @var string  
59
-	 */
60
-	private $ndc;
56
+    /** 
57
+     * The nested diagnostic context (NDC) of logging event.
58
+     * @var string  
59
+     */
60
+    private $ndc;
61 61
 	
62
-	/** 
63
-	 * Have we tried to do an NDC lookup? If we did, there is no need
64
-	 * to do it again.	Note that its value is always false when
65
-	 * serialized. Thus, a receiving SocketNode will never use it's own
66
-	 * (incorrect) NDC. See also writeObject method.
67
-	 * @var boolean
68
-	 */
69
-	private $ndcLookupRequired = true;
62
+    /** 
63
+     * Have we tried to do an NDC lookup? If we did, there is no need
64
+     * to do it again.	Note that its value is always false when
65
+     * serialized. Thus, a receiving SocketNode will never use it's own
66
+     * (incorrect) NDC. See also writeObject method.
67
+     * @var boolean
68
+     */
69
+    private $ndcLookupRequired = true;
70 70
 	
71
-	/** 
72
-	 * Have we tried to do an MDC lookup? If we did, there is no need
73
-	 * to do it again.	Note that its value is always false when
74
-	 * serialized. See also the getMDC and getMDCCopy methods.
75
-	 * @var boolean	 
76
-	 */
77
-	private $mdcCopyLookupRequired = true;
71
+    /** 
72
+     * Have we tried to do an MDC lookup? If we did, there is no need
73
+     * to do it again.	Note that its value is always false when
74
+     * serialized. See also the getMDC and getMDCCopy methods.
75
+     * @var boolean	 
76
+     */
77
+    private $mdcCopyLookupRequired = true;
78 78
 	
79
-	/** 
80
-	 * @var mixed The application supplied message of logging event. 
81
-	 */
82
-	private $message;
79
+    /** 
80
+     * @var mixed The application supplied message of logging event. 
81
+     */
82
+    private $message;
83 83
 	
84
-	/** 
85
-	 * The application supplied message rendered through the log4php
86
-	 * objet rendering mechanism. At present renderedMessage == message.
87
-	 * @var string
88
-	 */
89
-	private $renderedMessage = null;
84
+    /** 
85
+     * The application supplied message rendered through the log4php
86
+     * objet rendering mechanism. At present renderedMessage == message.
87
+     * @var string
88
+     */
89
+    private $renderedMessage = null;
90 90
 	
91
-	/** 
92
-	 * The name of thread in which this logging event was generated.
93
-	 * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
94
-	 * @var mixed
95
-	 */
96
-	private $threadName = null;
91
+    /** 
92
+     * The name of thread in which this logging event was generated.
93
+     * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
94
+     * @var mixed
95
+     */
96
+    private $threadName = null;
97 97
 	
98
-	/** 
99
-	* The number of seconds elapsed from 1/1/1970 until logging event
100
-	* was created plus microseconds if available.
101
-	* @var float
102
-	*/
103
-	public $timeStamp;
98
+    /** 
99
+     * The number of seconds elapsed from 1/1/1970 until logging event
100
+     * was created plus microseconds if available.
101
+     * @var float
102
+     */
103
+    public $timeStamp;
104 104
 	
105
-	/** 
106
-	* @var Payone_Log4php_LoggerLocationInfo Location information for the caller.
107
-	*/
108
-	private $locationInfo = null;
105
+    /** 
106
+     * @var Payone_Log4php_LoggerLocationInfo Location information for the caller.
107
+     */
108
+    private $locationInfo = null;
109 109
 	
110
-	/**
111
-	 * @var Payone_Log4php_LoggerThrowableInformation log4php internal representation of throwable
112
-	 */
113
-	private $throwableInfo = null;
110
+    /**
111
+     * @var Payone_Log4php_LoggerThrowableInformation log4php internal representation of throwable
112
+     */
113
+    private $throwableInfo = null;
114 114
 	
115
-	/**
116
-	* Instantiate a LoggingEvent from the supplied parameters.
117
-	*
118
-	* Except {@link $timeStamp} all the other fields of
119
-	* LoggerLoggingEvent are filled when actually needed.
120
-	*
121
-	* @param string $fqcn name of the caller class.
122
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
123
-	* @param Payone_Log4php_LoggerLevel $priority The level of this event.
124
-	* @param mixed $message The message of this event.
125
-	* @param integer $timeStamp the timestamp of this logging event.
126
-	* @param Exception $throwable The throwable associated with logging event
127
-	*/
128
-	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129
-		$this->fqcn = $fqcn;
130
-		if($logger instanceof Payone_Log4php_Logger) {
131
-			$this->logger = $logger;
132
-			$this->categoryName = $logger->getName();
133
-		} else {
134
-			$this->categoryName = strval($logger);
135
-		}
136
-		$this->level = $priority;
137
-		$this->message = $message;
138
-		if($timeStamp !== null && is_float($timeStamp)) {
139
-			$this->timeStamp = $timeStamp;
140
-		} else {
141
-			$this->timeStamp = microtime(true);
142
-		}
115
+    /**
116
+     * Instantiate a LoggingEvent from the supplied parameters.
117
+     *
118
+     * Except {@link $timeStamp} all the other fields of
119
+     * LoggerLoggingEvent are filled when actually needed.
120
+     *
121
+     * @param string $fqcn name of the caller class.
122
+     * @param mixed $logger The {@link Logger} category of this event or the logger name.
123
+     * @param Payone_Log4php_LoggerLevel $priority The level of this event.
124
+     * @param mixed $message The message of this event.
125
+     * @param integer $timeStamp the timestamp of this logging event.
126
+     * @param Exception $throwable The throwable associated with logging event
127
+     */
128
+    public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129
+        $this->fqcn = $fqcn;
130
+        if($logger instanceof Payone_Log4php_Logger) {
131
+            $this->logger = $logger;
132
+            $this->categoryName = $logger->getName();
133
+        } else {
134
+            $this->categoryName = strval($logger);
135
+        }
136
+        $this->level = $priority;
137
+        $this->message = $message;
138
+        if($timeStamp !== null && is_float($timeStamp)) {
139
+            $this->timeStamp = $timeStamp;
140
+        } else {
141
+            $this->timeStamp = microtime(true);
142
+        }
143 143
 		
144
-		if ($throwable !== null && $throwable instanceof Exception) {
145
-			$this->throwableInfo = new Payone_Log4php_LoggerThrowableInformation($throwable);
146
-		}
147
-	}
144
+        if ($throwable !== null && $throwable instanceof Exception) {
145
+            $this->throwableInfo = new Payone_Log4php_LoggerThrowableInformation($throwable);
146
+        }
147
+    }
148 148
 
149
-	/**
150
-	 * Returns the full qualified classname.
151
-	 * TODO: PHP does contain namespaces in 5.3. Those should be returned too, 
152
-	 */
153
-	 public function getFullQualifiedClassname() {
154
-		 return $this->fqcn;
155
-	 }
149
+    /**
150
+     * Returns the full qualified classname.
151
+     * TODO: PHP does contain namespaces in 5.3. Those should be returned too, 
152
+     */
153
+        public function getFullQualifiedClassname() {
154
+            return $this->fqcn;
155
+        }
156 156
 	 
157
-	/**
158
-	 * Set the location information for this logging event. The collected
159
-	 * information is cached for future use.
160
-	 *
161
-	 * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
162
-	 * to collect informations about caller.</p>
163
-	 * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
164
-	 * @return Payone_Log4php_LoggerLocationInfo
165
-	 */
166
-	public function getLocationInformation() {
167
-		if($this->locationInfo === null) {
157
+    /**
158
+     * Set the location information for this logging event. The collected
159
+     * information is cached for future use.
160
+     *
161
+     * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
162
+     * to collect informations about caller.</p>
163
+     * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
164
+     * @return Payone_Log4php_LoggerLocationInfo
165
+     */
166
+    public function getLocationInformation() {
167
+        if($this->locationInfo === null) {
168 168
 
169
-			$locationInfo = array();
170
-			$trace = debug_backtrace();
171
-			$prevHop = null;
172
-			// make a downsearch to identify the caller
173
-			$hop = array_pop($trace);
174
-			while($hop !== null) {
175
-				if(isset($hop['class'])) {
176
-					// we are sometimes in functions = no class available: avoid php warning here
177
-					$className = strtolower($hop['class']);
178
-					if(!empty($className) and ($className == 'logger' or 
179
-						strtolower(get_parent_class($className)) == 'logger')) {
180
-						$locationInfo['line'] = $hop['line'];
181
-						$locationInfo['file'] = $hop['file'];
182
-						break;
183
-					}
184
-				}
185
-				$prevHop = $hop;
186
-				$hop = array_pop($trace);
187
-			}
188
-			$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
-			if(isset($prevHop['function']) and
190
-				$prevHop['function'] !== 'include' and
191
-				$prevHop['function'] !== 'include_once' and
192
-				$prevHop['function'] !== 'require' and
193
-				$prevHop['function'] !== 'require_once') {
169
+            $locationInfo = array();
170
+            $trace = debug_backtrace();
171
+            $prevHop = null;
172
+            // make a downsearch to identify the caller
173
+            $hop = array_pop($trace);
174
+            while($hop !== null) {
175
+                if(isset($hop['class'])) {
176
+                    // we are sometimes in functions = no class available: avoid php warning here
177
+                    $className = strtolower($hop['class']);
178
+                    if(!empty($className) and ($className == 'logger' or 
179
+                        strtolower(get_parent_class($className)) == 'logger')) {
180
+                        $locationInfo['line'] = $hop['line'];
181
+                        $locationInfo['file'] = $hop['file'];
182
+                        break;
183
+                    }
184
+                }
185
+                $prevHop = $hop;
186
+                $hop = array_pop($trace);
187
+            }
188
+            $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
+            if(isset($prevHop['function']) and
190
+                $prevHop['function'] !== 'include' and
191
+                $prevHop['function'] !== 'include_once' and
192
+                $prevHop['function'] !== 'require' and
193
+                $prevHop['function'] !== 'require_once') {
194 194
 
195
-				$locationInfo['function'] = $prevHop['function'];
196
-			} else {
197
-				$locationInfo['function'] = 'main';
198
-			}
195
+                $locationInfo['function'] = $prevHop['function'];
196
+            } else {
197
+                $locationInfo['function'] = 'main';
198
+            }
199 199
 					 
200
-			$this->locationInfo = new Payone_Log4php_LoggerLocationInfo($locationInfo, $this->fqcn);
201
-		}
202
-		return $this->locationInfo;
203
-	}
200
+            $this->locationInfo = new Payone_Log4php_LoggerLocationInfo($locationInfo, $this->fqcn);
201
+        }
202
+        return $this->locationInfo;
203
+    }
204 204
 
205
-	/**
206
-	 * Return the level of this event. Use this form instead of directly
207
-	 * accessing the {@link $level} field.
208
-	 * @return Payone_Log4php_LoggerLevel
209
-	 */
210
-	public function getLevel() {
211
-		return $this->level;
212
-	}
205
+    /**
206
+     * Return the level of this event. Use this form instead of directly
207
+     * accessing the {@link $level} field.
208
+     * @return Payone_Log4php_LoggerLevel
209
+     */
210
+    public function getLevel() {
211
+        return $this->level;
212
+    }
213 213
 
214
-	/**
215
-	 * Returns the logger which created the event.
216
-	 * @return Logger
217
-	 */
218
-	public function getLogger() {
219
-		return $this->logger;
220
-	}
214
+    /**
215
+     * Returns the logger which created the event.
216
+     * @return Logger
217
+     */
218
+    public function getLogger() {
219
+        return $this->logger;
220
+    }
221 221
 	
222
-	/**
223
-	 * Return the name of the logger. Use this form instead of directly
224
-	 * accessing the {@link $categoryName} field.
225
-	 * @return string  
226
-	 */
227
-	public function getLoggerName() {
228
-		return $this->categoryName;
229
-	}
222
+    /**
223
+     * Return the name of the logger. Use this form instead of directly
224
+     * accessing the {@link $categoryName} field.
225
+     * @return string  
226
+     */
227
+    public function getLoggerName() {
228
+        return $this->categoryName;
229
+    }
230 230
 
231
-	/**
232
-	 * Return the message for this logging event.
233
-	 *
234
-	 * <p>Before serialization, the returned object is the message
235
-	 * passed by the user to generate the logging event. After
236
-	 * serialization, the returned value equals the String form of the
237
-	 * message possibly after object rendering.
238
-	 * @return mixed
239
-	 */
240
-	public function getMessage() {
241
-		if($this->message !== null) {
242
-			return $this->message;
243
-		} else {
244
-			return $this->getRenderedMessage();
245
-		}
246
-	}
231
+    /**
232
+     * Return the message for this logging event.
233
+     *
234
+     * <p>Before serialization, the returned object is the message
235
+     * passed by the user to generate the logging event. After
236
+     * serialization, the returned value equals the String form of the
237
+     * message possibly after object rendering.
238
+     * @return mixed
239
+     */
240
+    public function getMessage() {
241
+        if($this->message !== null) {
242
+            return $this->message;
243
+        } else {
244
+            return $this->getRenderedMessage();
245
+        }
246
+    }
247 247
 
248
-	/**
249
-	 * This method returns the NDC for this event. It will return the
250
-	 * correct content even if the event was generated in a different
251
-	 * thread or even on a different machine. The {@link LoggerNDC::get()} method
252
-	 * should <b>never</b> be called directly.
253
-	 * @return string  
254
-	 */
255
-	public function getNDC() {
256
-		if($this->ndcLookupRequired) {
257
-			$this->ndcLookupRequired = false;
258
-			$this->ndc = Payone_Log4php_LoggerNDC::get();
259
-		}
260
-		return $this->ndc;
261
-	}
248
+    /**
249
+     * This method returns the NDC for this event. It will return the
250
+     * correct content even if the event was generated in a different
251
+     * thread or even on a different machine. The {@link LoggerNDC::get()} method
252
+     * should <b>never</b> be called directly.
253
+     * @return string  
254
+     */
255
+    public function getNDC() {
256
+        if($this->ndcLookupRequired) {
257
+            $this->ndcLookupRequired = false;
258
+            $this->ndc = Payone_Log4php_LoggerNDC::get();
259
+        }
260
+        return $this->ndc;
261
+    }
262 262
 
263
-	/**
264
-	 * Returns the the context corresponding to the <code>key</code>
265
-	 * parameter.
266
-	 * @return string
267
-	 */
268
-	public function getMDC($key) {
269
-		return Payone_Log4php_LoggerMDC::get($key);
270
-	}
263
+    /**
264
+     * Returns the the context corresponding to the <code>key</code>
265
+     * parameter.
266
+     * @return string
267
+     */
268
+    public function getMDC($key) {
269
+        return Payone_Log4php_LoggerMDC::get($key);
270
+    }
271 271
 	
272
-	/**
273
-	 * Returns the entire MDC context.
274
-	 * @return array
275
-	 */
276
-	public function getMDCMap () {
277
-		return Payone_Log4php_LoggerMDC::getMap();
278
-	}
272
+    /**
273
+     * Returns the entire MDC context.
274
+     * @return array
275
+     */
276
+    public function getMDCMap () {
277
+        return Payone_Log4php_LoggerMDC::getMap();
278
+    }
279 279
 
280
-	/**
281
-	 * Render message.
282
-	 * @return string
283
-	 */
284
-	public function getRenderedMessage() {
285
-		if($this->renderedMessage === null and $this->message !== null) {
286
-			if(is_string($this->message)) {
287
-				$this->renderedMessage = $this->message;
288
-			} else {
289
-				$rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
291
-			}
292
-		}
293
-		return $this->renderedMessage;
294
-	}
280
+    /**
281
+     * Render message.
282
+     * @return string
283
+     */
284
+    public function getRenderedMessage() {
285
+        if($this->renderedMessage === null and $this->message !== null) {
286
+            if(is_string($this->message)) {
287
+                $this->renderedMessage = $this->message;
288
+            } else {
289
+                $rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
+                $this->renderedMessage= $rendererMap->findAndRender($this->message);
291
+            }
292
+        }
293
+        return $this->renderedMessage;
294
+    }
295 295
 
296
-	/**
297
-	 * Returns the time when the application started, as a UNIX timestamp 
298
-	 * with microseconds.
299
-	 * @return float
300
-	 */
301
-	public static function getStartTime() {
302
-		if(!isset(self::$startTime)) {
303
-			self::$startTime = microtime(true);
304
-		}
305
-		return self::$startTime; 
306
-	}
296
+    /**
297
+     * Returns the time when the application started, as a UNIX timestamp 
298
+     * with microseconds.
299
+     * @return float
300
+     */
301
+    public static function getStartTime() {
302
+        if(!isset(self::$startTime)) {
303
+            self::$startTime = microtime(true);
304
+        }
305
+        return self::$startTime; 
306
+    }
307 307
 
308
-	/**
309
-	 * @return float
310
-	 */
311
-	public function getTimeStamp() {
312
-		return $this->timeStamp;
313
-	}
308
+    /**
309
+     * @return float
310
+     */
311
+    public function getTimeStamp() {
312
+        return $this->timeStamp;
313
+    }
314 314
 	
315
-	/**
316
-	 * Calculates the time of this event.
317
-	 * @return the time after event starttime when this event has occured
318
-	 */
319
-	public function getTime() {
320
-		$eventTime = $this->getTimeStamp();
321
-		$eventStartTime = Payone_Log4php_LoggerLoggingEvent::getStartTime();
322
-		return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
323
-	}
315
+    /**
316
+     * Calculates the time of this event.
317
+     * @return the time after event starttime when this event has occured
318
+     */
319
+    public function getTime() {
320
+        $eventTime = $this->getTimeStamp();
321
+        $eventStartTime = Payone_Log4php_LoggerLoggingEvent::getStartTime();
322
+        return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
323
+    }
324 324
 	
325
-	/**
326
-	 * @return mixed
327
-	 */
328
-	public function getThreadName() {
329
-		if ($this->threadName === null) {
330
-			$this->threadName = (string)getmypid();
331
-		}
332
-		return $this->threadName;
333
-	}
325
+    /**
326
+     * @return mixed
327
+     */
328
+    public function getThreadName() {
329
+        if ($this->threadName === null) {
330
+            $this->threadName = (string)getmypid();
331
+        }
332
+        return $this->threadName;
333
+    }
334 334
 
335
-	/**
336
-	 * @return mixed LoggerThrowableInformation
337
-	 */
338
-	public function getThrowableInformation() {
339
-		return $this->throwableInfo;
340
-	}
335
+    /**
336
+     * @return mixed LoggerThrowableInformation
337
+     */
338
+    public function getThrowableInformation() {
339
+        return $this->throwableInfo;
340
+    }
341 341
 	
342
-	/**
343
-	 * Serialize this object
344
-	 * @return string
345
-	 */
346
-	public function toString() {
347
-		serialize($this);
348
-	}
342
+    /**
343
+     * Serialize this object
344
+     * @return string
345
+     */
346
+    public function toString() {
347
+        serialize($this);
348
+    }
349 349
 	
350
-	/**
351
-	 * Avoid serialization of the {@link $logger} object
352
-	 */
353
-	public function __sleep() {
354
-		return array(
355
-			'fqcn',
356
-			'categoryName',
357
-			'level',
358
-			'ndc',
359
-			'ndcLookupRequired',
360
-			'message',
361
-			'renderedMessage',
362
-			'threadName',
363
-			'timeStamp',
364
-			'locationInfo',
365
-		);
366
-	}
350
+    /**
351
+     * Avoid serialization of the {@link $logger} object
352
+     */
353
+    public function __sleep() {
354
+        return array(
355
+            'fqcn',
356
+            'categoryName',
357
+            'level',
358
+            'ndc',
359
+            'ndcLookupRequired',
360
+            'message',
361
+            'renderedMessage',
362
+            'threadName',
363
+            'timeStamp',
364
+            'locationInfo',
365
+        );
366
+    }
367 367
 
368 368
 }
369 369
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	*/
128 128
 	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
129 129
 		$this->fqcn = $fqcn;
130
-		if($logger instanceof Payone_Log4php_Logger) {
130
+		if ($logger instanceof Payone_Log4php_Logger) {
131 131
 			$this->logger = $logger;
132 132
 			$this->categoryName = $logger->getName();
133 133
 		} else {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		}
136 136
 		$this->level = $priority;
137 137
 		$this->message = $message;
138
-		if($timeStamp !== null && is_float($timeStamp)) {
138
+		if ($timeStamp !== null && is_float($timeStamp)) {
139 139
 			$this->timeStamp = $timeStamp;
140 140
 		} else {
141 141
 			$this->timeStamp = microtime(true);
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 	 * @return Payone_Log4php_LoggerLocationInfo
165 165
 	 */
166 166
 	public function getLocationInformation() {
167
-		if($this->locationInfo === null) {
167
+		if ($this->locationInfo === null) {
168 168
 
169 169
 			$locationInfo = array();
170 170
 			$trace = debug_backtrace();
171 171
 			$prevHop = null;
172 172
 			// make a downsearch to identify the caller
173 173
 			$hop = array_pop($trace);
174
-			while($hop !== null) {
175
-				if(isset($hop['class'])) {
174
+			while ($hop !== null) {
175
+				if (isset($hop['class'])) {
176 176
 					// we are sometimes in functions = no class available: avoid php warning here
177 177
 					$className = strtolower($hop['class']);
178
-					if(!empty($className) and ($className == 'logger' or 
178
+					if (!empty($className) and ($className == 'logger' or 
179 179
 						strtolower(get_parent_class($className)) == 'logger')) {
180 180
 						$locationInfo['line'] = $hop['line'];
181 181
 						$locationInfo['file'] = $hop['file'];
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				$hop = array_pop($trace);
187 187
 			}
188 188
 			$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
189
-			if(isset($prevHop['function']) and
189
+			if (isset($prevHop['function']) and
190 190
 				$prevHop['function'] !== 'include' and
191 191
 				$prevHop['function'] !== 'include_once' and
192 192
 				$prevHop['function'] !== 'require' and
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return mixed
239 239
 	 */
240 240
 	public function getMessage() {
241
-		if($this->message !== null) {
241
+		if ($this->message !== null) {
242 242
 			return $this->message;
243 243
 		} else {
244 244
 			return $this->getRenderedMessage();
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return string  
254 254
 	 */
255 255
 	public function getNDC() {
256
-		if($this->ndcLookupRequired) {
256
+		if ($this->ndcLookupRequired) {
257 257
 			$this->ndcLookupRequired = false;
258 258
 			$this->ndc = Payone_Log4php_LoggerNDC::get();
259 259
 		}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * Returns the entire MDC context.
274 274
 	 * @return array
275 275
 	 */
276
-	public function getMDCMap () {
276
+	public function getMDCMap() {
277 277
 		return Payone_Log4php_LoggerMDC::getMap();
278 278
 	}
279 279
 
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
 	 * @return string
283 283
 	 */
284 284
 	public function getRenderedMessage() {
285
-		if($this->renderedMessage === null and $this->message !== null) {
286
-			if(is_string($this->message)) {
285
+		if ($this->renderedMessage === null and $this->message !== null) {
286
+			if (is_string($this->message)) {
287 287
 				$this->renderedMessage = $this->message;
288 288
 			} else {
289 289
 				$rendererMap = Payone_Log4php_Logger::getHierarchy()->getRendererMap();
290
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
290
+				$this->renderedMessage = $rendererMap->findAndRender($this->message);
291 291
 			}
292 292
 		}
293 293
 		return $this->renderedMessage;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return float
300 300
 	 */
301 301
 	public static function getStartTime() {
302
-		if(!isset(self::$startTime)) {
302
+		if (!isset(self::$startTime)) {
303 303
 			self::$startTime = microtime(true);
304 304
 		}
305 305
 		return self::$startTime; 
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerNDC.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 
113 113
 	/**
114 114
 	 * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
115
-	 * @return array
115
+	 * @return string
116 116
 	 */
117 117
 	public static function get() {
118 118
 		return implode(' ', self::$stack);
Please login to merge, or discard this patch.
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -95,109 +95,109 @@
 block discarded – undo
95 95
  */
96 96
 class Payone_Log4php_LoggerNDC {
97 97
 	
98
-	/** This is the repository of NDC stack */
99
-	private static $stack = array();
98
+    /** This is the repository of NDC stack */
99
+    private static $stack = array();
100 100
 	
101
-	/**
102
-	 * Clear any nested diagnostic information if any. This method is
103
-	 * useful in cases where the same thread can be potentially used
104
-	 * over and over in different unrelated contexts.
105
-	 *
106
-	 * <p>This method is equivalent to calling the {@link setMaxDepth()}
107
-	 * method with a zero <var>maxDepth</var> argument.
108
-	 */
109
-	public static function clear() {
110
-		self::$stack = array();
111
-	}
101
+    /**
102
+     * Clear any nested diagnostic information if any. This method is
103
+     * useful in cases where the same thread can be potentially used
104
+     * over and over in different unrelated contexts.
105
+     *
106
+     * <p>This method is equivalent to calling the {@link setMaxDepth()}
107
+     * method with a zero <var>maxDepth</var> argument.
108
+     */
109
+    public static function clear() {
110
+        self::$stack = array();
111
+    }
112 112
 
113
-	/**
114
-	 * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
115
-	 * @return array
116
-	 */
117
-	public static function get() {
118
-		return implode(' ', self::$stack);
119
-	}
113
+    /**
114
+     * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
115
+     * @return array
116
+     */
117
+    public static function get() {
118
+        return implode(' ', self::$stack);
119
+    }
120 120
   
121
-	/**
122
-	 * Get the current nesting depth of this diagnostic context.
123
-	 *
124
-	 * @see setMaxDepth()
125
-	 * @return integer
126
-	 */
127
-	public static function getDepth() {
128
-		return count(self::$stack);
129
-	}
121
+    /**
122
+     * Get the current nesting depth of this diagnostic context.
123
+     *
124
+     * @see setMaxDepth()
125
+     * @return integer
126
+     */
127
+    public static function getDepth() {
128
+        return count(self::$stack);
129
+    }
130 130
 
131
-	/**
132
-	 * Clients should call this method before leaving a diagnostic
133
-	 * context.
134
-	 *
135
-	 * <p>The returned value is the value that was pushed last. If no
136
-	 * context is available, then the empty string "" is returned.</p>
137
-	 *
138
-	 * @return string The innermost diagnostic context.
139
-	 */
140
-	public static function pop() {
141
-		if(count(self::$stack) > 0) {
142
-			return array_pop(self::$stack);
143
-		} else {
144
-			return '';
145
-		}
146
-	}
131
+    /**
132
+     * Clients should call this method before leaving a diagnostic
133
+     * context.
134
+     *
135
+     * <p>The returned value is the value that was pushed last. If no
136
+     * context is available, then the empty string "" is returned.</p>
137
+     *
138
+     * @return string The innermost diagnostic context.
139
+     */
140
+    public static function pop() {
141
+        if(count(self::$stack) > 0) {
142
+            return array_pop(self::$stack);
143
+        } else {
144
+            return '';
145
+        }
146
+    }
147 147
 
148
-	/**
149
-	 * Looks at the last diagnostic context at the top of this NDC
150
-	 * without removing it.
151
-	 *
152
-	 * <p>The returned value is the value that was pushed last. If no
153
-	 * context is available, then the empty string "" is returned.</p>
154
-	 * @return string The innermost diagnostic context.
155
-	 */
156
-	public static function peek(){
157
-		if(count(self::$stack) > 0) {
158
-			return end(self::$stack);
159
-		} else {
160
-			return '';
161
-		}
162
-	}
148
+    /**
149
+     * Looks at the last diagnostic context at the top of this NDC
150
+     * without removing it.
151
+     *
152
+     * <p>The returned value is the value that was pushed last. If no
153
+     * context is available, then the empty string "" is returned.</p>
154
+     * @return string The innermost diagnostic context.
155
+     */
156
+    public static function peek(){
157
+        if(count(self::$stack) > 0) {
158
+            return end(self::$stack);
159
+        } else {
160
+            return '';
161
+        }
162
+    }
163 163
   
164
-	/**
165
-	 * Push new diagnostic context information for the current thread.
166
-	 *
167
-	 * <p>The contents of the <var>message</var> parameter is
168
-	 * determined solely by the client.
169
-	 *	
170
-	 * @param string $message The new diagnostic context information.
171
-	 */
172
-	public static function push($message) {
173
-		array_push(self::$stack, (string)$message);
174
-	}
164
+    /**
165
+     * Push new diagnostic context information for the current thread.
166
+     *
167
+     * <p>The contents of the <var>message</var> parameter is
168
+     * determined solely by the client.
169
+     *	
170
+     * @param string $message The new diagnostic context information.
171
+     */
172
+    public static function push($message) {
173
+        array_push(self::$stack, (string)$message);
174
+    }
175 175
 
176
-	/**
177
-	 * Remove the diagnostic context for this thread.
178
-	 */
179
-	public static function remove() {
180
-		Payone_Log4php_LoggerNDC::clear();
181
-	}
176
+    /**
177
+     * Remove the diagnostic context for this thread.
178
+     */
179
+    public static function remove() {
180
+        Payone_Log4php_LoggerNDC::clear();
181
+    }
182 182
 
183
-	/**
184
-	 * Set maximum depth of this diagnostic context. If the current
185
-	 * depth is smaller or equal to <var>maxDepth</var>, then no
186
-	 * action is taken.
187
-	 *
188
-	 * <p>This method is a convenient alternative to multiple 
189
-	 * {@link pop()} calls. Moreover, it is often the case that at 
190
-	 * the end of complex call sequences, the depth of the NDC is
191
-	 * unpredictable. The {@link setMaxDepth()} method circumvents
192
-	 * this problem.
193
-	 *
194
-	 * @param integer $maxDepth
195
-	 * @see getDepth()
196
-	 */
197
-	public static function setMaxDepth($maxDepth) {
198
-		$maxDepth = (int)$maxDepth;
199
-		if(Payone_Log4php_LoggerNDC::getDepth() > $maxDepth) {
200
-			self::$stack = array_slice(self::$stack, 0, $maxDepth);
201
-		}
202
-	}
183
+    /**
184
+     * Set maximum depth of this diagnostic context. If the current
185
+     * depth is smaller or equal to <var>maxDepth</var>, then no
186
+     * action is taken.
187
+     *
188
+     * <p>This method is a convenient alternative to multiple 
189
+     * {@link pop()} calls. Moreover, it is often the case that at 
190
+     * the end of complex call sequences, the depth of the NDC is
191
+     * unpredictable. The {@link setMaxDepth()} method circumvents
192
+     * this problem.
193
+     *
194
+     * @param integer $maxDepth
195
+     * @see getDepth()
196
+     */
197
+    public static function setMaxDepth($maxDepth) {
198
+        $maxDepth = (int)$maxDepth;
199
+        if(Payone_Log4php_LoggerNDC::getDepth() > $maxDepth) {
200
+            self::$stack = array_slice(self::$stack, 0, $maxDepth);
201
+        }
202
+    }
203 203
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return string The innermost diagnostic context.
139 139
 	 */
140 140
 	public static function pop() {
141
-		if(count(self::$stack) > 0) {
141
+		if (count(self::$stack) > 0) {
142 142
 			return array_pop(self::$stack);
143 143
 		} else {
144 144
 			return '';
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * context is available, then the empty string "" is returned.</p>
154 154
 	 * @return string The innermost diagnostic context.
155 155
 	 */
156
-	public static function peek(){
157
-		if(count(self::$stack) > 0) {
156
+	public static function peek() {
157
+		if (count(self::$stack) > 0) {
158 158
 			return end(self::$stack);
159 159
 		} else {
160 160
 			return '';
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public static function setMaxDepth($maxDepth) {
198 198
 		$maxDepth = (int)$maxDepth;
199
-		if(Payone_Log4php_LoggerNDC::getDepth() > $maxDepth) {
199
+		if (Payone_Log4php_LoggerNDC::getDepth() > $maxDepth) {
200 200
 			self::$stack = array_slice(self::$stack, 0, $maxDepth);
201 201
 		}
202 202
 	}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverter.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -73,6 +73,7 @@
 block discarded – undo
73 73
 	 * converters must implement this method.
74 74
 	 *
75 75
 	 * @param Payone_Log4php_LoggerLoggingEvent $event
76
+	 * @return string
76 77
 	 */
77 78
 	abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
78 79
 
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -33,99 +33,99 @@
 block discarded – undo
33 33
  */
34 34
 abstract class Payone_Log4php_LoggerPatternConverter {
35 35
 	
36
-	/**
37
-	 * Next converter in the converter chain.
38
-	 * @var Payone_Log4php_LoggerPatternConverter
39
-	 */
40
-	public $next = null;
36
+    /**
37
+     * Next converter in the converter chain.
38
+     * @var Payone_Log4php_LoggerPatternConverter
39
+     */
40
+    public $next = null;
41 41
 	
42
-	/**
43
-	 * Formatting information, parsed from pattern modifiers. 
44
-	 * @var Payone_Log4php_LoggerFormattingInfo
45
-	 */
46
-	protected $formattingInfo;
42
+    /**
43
+     * Formatting information, parsed from pattern modifiers. 
44
+     * @var Payone_Log4php_LoggerFormattingInfo
45
+     */
46
+    protected $formattingInfo;
47 47
 	
48
-	/**
49
-	 * Converter-specific formatting options.
50
-	 * @var array
51
-	 */
52
-	protected $option;
48
+    /**
49
+     * Converter-specific formatting options.
50
+     * @var array
51
+     */
52
+    protected $option;
53 53
 
54
-	/**
55
-	 * Constructor 
56
-	 * @param Payone_Log4php_LoggerFormattingInfo $formattingInfo
57
-	 * @param array $option
58
-	 */
59
-	public function __construct(Payone_Log4php_LoggerFormattingInfo $formattingInfo = null, $option = null) {
60
-		$this->formattingInfo = $formattingInfo;
61
-		$this->option = $option;
62
-		$this->activateOptions();
63
-	}
54
+    /**
55
+     * Constructor 
56
+     * @param Payone_Log4php_LoggerFormattingInfo $formattingInfo
57
+     * @param array $option
58
+     */
59
+    public function __construct(Payone_Log4php_LoggerFormattingInfo $formattingInfo = null, $option = null) {
60
+        $this->formattingInfo = $formattingInfo;
61
+        $this->option = $option;
62
+        $this->activateOptions();
63
+    }
64 64
 	
65
-	/**
66
-	 * Called in constructor. Converters which need to process the options 
67
-	 * can override this method. 
68
-	 */
69
-	public function activateOptions() { }
65
+    /**
66
+     * Called in constructor. Converters which need to process the options 
67
+     * can override this method. 
68
+     */
69
+    public function activateOptions() { }
70 70
   
71
-	/**
72
-	 * Converts the logging event to the desired format. Derived pattern 
73
-	 * converters must implement this method.
74
-	 *
75
-	 * @param Payone_Log4php_LoggerLoggingEvent $event
76
-	 */
77
-	abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
71
+    /**
72
+     * Converts the logging event to the desired format. Derived pattern 
73
+     * converters must implement this method.
74
+     *
75
+     * @param Payone_Log4php_LoggerLoggingEvent $event
76
+     */
77
+    abstract public function convert(Payone_Log4php_LoggerLoggingEvent $event);
78 78
 
79
-	/**
80
-	 * Converts the event and formats it according to setting in the 
81
-	 * Formatting information object.
82
-	 *
83
-	 * @param string &$sbuf string buffer to write to
84
-	 * @param Payone_Log4php_LoggerLoggingEvent $event Event to be formatted.
85
-	 */
86
-	public function format(&$sbuf, $event) {
87
-		$string = $this->convert($event);
79
+    /**
80
+     * Converts the event and formats it according to setting in the 
81
+     * Formatting information object.
82
+     *
83
+     * @param string &$sbuf string buffer to write to
84
+     * @param Payone_Log4php_LoggerLoggingEvent $event Event to be formatted.
85
+     */
86
+    public function format(&$sbuf, $event) {
87
+        $string = $this->convert($event);
88 88
 		
89
-		if (!isset($this->formattingInfo)) {
90
-			$sbuf .= $string;
91
-			return;	
92
-		}
89
+        if (!isset($this->formattingInfo)) {
90
+            $sbuf .= $string;
91
+            return;	
92
+        }
93 93
 		
94
-		$fi = $this->formattingInfo;
94
+        $fi = $this->formattingInfo;
95 95
 		
96
-		// Empty string
97
-		if($string === '' || is_null($string)) {
98
-			if($fi->min > 0) {
99
-				$sbuf .= str_repeat(' ', $fi->min);
100
-			}
101
-			return;
102
-		}
96
+        // Empty string
97
+        if($string === '' || is_null($string)) {
98
+            if($fi->min > 0) {
99
+                $sbuf .= str_repeat(' ', $fi->min);
100
+            }
101
+            return;
102
+        }
103 103
 		
104
-		$len = strlen($string);
104
+        $len = strlen($string);
105 105
 	
106
-		// Trim the string if needed
107
-		if($len > $fi->max) {
108
-			if ($fi->trimLeft) {
109
-				$sbuf .= substr($string, $len - $fi->max, $fi->max);
110
-			} else {
111
-				$sbuf .= substr($string , 0, $fi->max);
112
-			}
113
-		}
106
+        // Trim the string if needed
107
+        if($len > $fi->max) {
108
+            if ($fi->trimLeft) {
109
+                $sbuf .= substr($string, $len - $fi->max, $fi->max);
110
+            } else {
111
+                $sbuf .= substr($string , 0, $fi->max);
112
+            }
113
+        }
114 114
 		
115
-		// Add padding if needed
116
-		else if($len < $fi->min) {
117
-			if($fi->padLeft) {
118
-				$sbuf .= str_repeat(' ', $fi->min - $len);
119
-				$sbuf .= $string;
120
-			} else {
121
-				$sbuf .= $string;
122
-				$sbuf .= str_repeat(' ', $fi->min - $len);
123
-			}
124
-		}
115
+        // Add padding if needed
116
+        else if($len < $fi->min) {
117
+            if($fi->padLeft) {
118
+                $sbuf .= str_repeat(' ', $fi->min - $len);
119
+                $sbuf .= $string;
120
+            } else {
121
+                $sbuf .= $string;
122
+                $sbuf .= str_repeat(' ', $fi->min - $len);
123
+            }
124
+        }
125 125
 		
126
-		// No action needed
127
-		else {
128
-			$sbuf .= $string;
129
-		}
130
-	}
126
+        // No action needed
127
+        else {
128
+            $sbuf .= $string;
129
+        }
130
+    }
131 131
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		$fi = $this->formattingInfo;
95 95
 		
96 96
 		// Empty string
97
-		if($string === '' || is_null($string)) {
98
-			if($fi->min > 0) {
97
+		if ($string === '' || is_null($string)) {
98
+			if ($fi->min > 0) {
99 99
 				$sbuf .= str_repeat(' ', $fi->min);
100 100
 			}
101 101
 			return;
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 		$len = strlen($string);
105 105
 	
106 106
 		// Trim the string if needed
107
-		if($len > $fi->max) {
107
+		if ($len > $fi->max) {
108 108
 			if ($fi->trimLeft) {
109 109
 				$sbuf .= substr($string, $len - $fi->max, $fi->max);
110 110
 			} else {
111
-				$sbuf .= substr($string , 0, $fi->max);
111
+				$sbuf .= substr($string, 0, $fi->max);
112 112
 			}
113 113
 		}
114 114
 		
115 115
 		// Add padding if needed
116
-		else if($len < $fi->min) {
117
-			if($fi->padLeft) {
116
+		else if ($len < $fi->min) {
117
+			if ($fi->padLeft) {
118 118
 				$sbuf .= str_repeat(' ', $fi->min - $len);
119 119
 				$sbuf .= $string;
120 120
 			} else {
Please login to merge, or discard this patch.