Completed
Branch master (d77618)
by Florian
06:00
created
lib/Payone/Log4php/LoggerConfiguratorDefault.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$info = pathinfo($url);
168 168
 		$ext = strtolower($info['extension']);
169 169
 		
170
-		switch($ext) {
170
+		switch ($ext) {
171 171
 			case 'xml':
172 172
 				return self::FORMAT_XML;
173 173
 			
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		
202 202
 		// Configure appenders and add them to the appender pool
203 203
 		if (isset($config['appenders']) && is_array($config['appenders'])) {
204
-			foreach($config['appenders'] as $name => $appenderConfig) {
204
+			foreach ($config['appenders'] as $name => $appenderConfig) {
205 205
 				$this->configureAppender($name, $appenderConfig);
206 206
 			}
207 207
 		}
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 		
214 214
 		// Configure loggers
215 215
 		if (isset($config['loggers']) && is_array($config['loggers'])) {
216
-			foreach($config['loggers'] as $loggerName => $loggerConfig) {
216
+			foreach ($config['loggers'] as $loggerName => $loggerConfig) {
217 217
 				$this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
218 218
 			}
219 219
 		}
220 220
 
221 221
 		// Configure renderers
222 222
 		if (isset($config['renderers']) && is_array($config['renderers'])) {
223
-			foreach($config['renderers'] as $rendererConfig) {
223
+			foreach ($config['renderers'] as $rendererConfig) {
224 224
 				$this->configureRenderer($hierarchy, $rendererConfig);
225 225
 			}
226 226
 		}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		
309 309
 		// Parse filters
310 310
 		if (isset($config['filters']) && is_array($config['filters'])) {
311
-			foreach($config['filters'] as $filterConfig) {
311
+			foreach ($config['filters'] as $filterConfig) {
312 312
 				$this->createAppenderFilter($appender, $filterConfig);
313 313
 			}
314 314
 		}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		
424 424
 		// Link appenders to logger
425 425
 		if (isset($config['appenders'])) {
426
-			foreach($config['appenders'] as $appenderName) {
426
+			foreach ($config['appenders'] as $appenderName) {
427 427
 				if (isset($this->appenders[$appenderName])) {
428 428
 					$logger->addAppender($this->appenders[$appenderName]);
429 429
 				} else {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @param unknown_type $options
468 468
 	 */
469 469
 	private function setOptions($object, $options) {
470
-		foreach($options as $name => $value) {
470
+		foreach ($options as $name => $value) {
471 471
 			$setter = "set$name";
472 472
 			if (method_exists($object, $setter)) {
473 473
 				$object->$setter($value);
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternConverter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		$fi = $this->formattingInfo;
95 95
 		
96 96
 		// Empty string
97
-		if($string === '' || is_null($string)) {
98
-			if($fi->min > 0) {
97
+		if ($string === '' || is_null($string)) {
98
+			if ($fi->min > 0) {
99 99
 				$sbuf .= str_repeat(' ', $fi->min);
100 100
 			}
101 101
 			return;
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 		$len = strlen($string);
105 105
 	
106 106
 		// Trim the string if needed
107
-		if($len > $fi->max) {
107
+		if ($len > $fi->max) {
108 108
 			if ($fi->trimLeft) {
109 109
 				$sbuf .= substr($string, $len - $fi->max, $fi->max);
110 110
 			} else {
111
-				$sbuf .= substr($string , 0, $fi->max);
111
+				$sbuf .= substr($string, 0, $fi->max);
112 112
 			}
113 113
 		}
114 114
 		
115 115
 		// Add padding if needed
116
-		else if($len < $fi->min) {
117
-			if($fi->padLeft) {
116
+		else if ($len < $fi->min) {
117
+			if ($fi->padLeft) {
118 118
 				$sbuf .= str_repeat(' ', $fi->min - $len);
119 119
 				$sbuf .= $string;
120 120
 			} else {
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderDailyFile.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,17 +83,17 @@
 block discarded – undo
83 83
 		$date = date($this->getDatePattern());
84 84
 		$fileName = sprintf($fileName, $date);
85 85
 		
86
-		if(!is_file($fileName)) {
86
+		if (!is_file($fileName)) {
87 87
 			$dir = dirname($fileName);
88
-			if(!is_dir($dir)) {
88
+			if (!is_dir($dir)) {
89 89
 				mkdir($dir, 0777, true);
90 90
 			}
91 91
 		}
92 92
 	
93
-		$this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
94
-		if($this->fp) {
95
-			if(flock($this->fp, LOCK_EX)) {
96
-				if($this->getAppend()) {
93
+		$this->fp = fopen($fileName, ($this->getAppend() ? 'a' : 'w'));
94
+		if ($this->fp) {
95
+			if (flock($this->fp, LOCK_EX)) {
96
+				if ($this->getAppend()) {
97 97
 					fseek($this->fp, 0, SEEK_END);
98 98
 				}
99 99
 				fwrite($this->fp, $this->layout->getHeader());
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerThrowableInformation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 * @param $throwable - a throwable as a exception
42 42
 	 * @param $logger - Logger reference
43 43
 	 */
44
-	public function __construct(Exception $throwable)  {
44
+	public function __construct(Exception $throwable) {
45 45
 		$this->throwable = $throwable;
46 46
 	}
47 47
 	
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerPatternParser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		
61 61
 		// Construct the regex pattern
62 62
 		$this->regex = 
63
-			'/' .                       // Starting regex pattern delimiter
64
-			self::ESCAPE_CHAR .         // Character which marks the start of the conversion pattern
63
+			'/' . // Starting regex pattern delimiter
64
+			self::ESCAPE_CHAR . // Character which marks the start of the conversion pattern
65 65
 			'(?P<modifiers>[0-9.-]*)' . // Format modifiers (optional)
66
-			'(?P<word>[a-zA-Z]+)' .     // The conversion word
67
-			'(?P<option>{[^}]*})?' .   // Conversion option in braces (optional)
68
-			'/';                        // Ending regex pattern delimiter
66
+			'(?P<word>[a-zA-Z]+)' . // The conversion word
67
+			'(?P<option>{[^}]*})?' . // Conversion option in braces (optional)
68
+			'/'; // Ending regex pattern delimiter
69 69
 	}
70 70
 	
71 71
 	/** 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		
92 92
 		$prevEnd = 0;
93 93
 		
94
-		foreach($matches[0] as $key => $item) {
94
+		foreach ($matches[0] as $key => $item) {
95 95
 			
96 96
 			// Locate where the conversion command starts and ends
97 97
 			$length = strlen($item[0]);
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 		}
173 173
 		
174 174
 		$converterClass = $this->converterMap[$word];
175
-		if(!class_exists($converterClass)) {
175
+		if (!class_exists($converterClass)) {
176 176
 			throw new Payone_Log4php_LoggerException("Class '$converterClass' does not exist.");
177 177
 		}
178 178
 		
179 179
 		$converter = new $converterClass($info, $option);
180
-		if(!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
180
+		if (!($converter instanceof Payone_Log4php_LoggerPatternConverter)) {
181 181
 			throw new Payone_Log4php_LoggerException("Class '$converterClass' is not an instance of Payone_Log4php_LoggerPatternConverter.");
182 182
 		}
183 183
 		
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		$parts = explode('.', $modifiers);
222 222
 	
223 223
 		if (!empty($parts[0])) {
224
-			$minPart = (integer) $parts[0];
224
+			$minPart = (integer)$parts[0];
225 225
 			$info->min = abs($minPart);
226 226
 			$info->padLeft = ($minPart > 0);
227 227
 		}
228 228
 	
229 229
 		if (!empty($parts[1])) {
230
-			$maxPart = (integer) $parts[1];
230
+			$maxPart = (integer)$parts[1];
231 231
 			$info->max = abs($maxPart);
232 232
 			$info->trimLeft = ($maxPart > 0);
233 233
 		}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerAppenderEcho.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	protected $htmlLineBreaks = false;
52 52
 	
53 53
 	public function close() {
54
-		if($this->closed != true) {
55
-			if(!$this->firstAppend) {
54
+		if ($this->closed != true) {
55
+			if (!$this->firstAppend) {
56 56
 				echo $this->layout->getFooter();
57 57
 			}
58 58
 		}
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
63
-		if($this->layout !== null) {
64
-			if($this->firstAppend) {
63
+		if ($this->layout !== null) {
64
+			if ($this->firstAppend) {
65 65
 				echo $this->layout->getHeader();
66 66
 				$this->firstAppend = false;
67 67
 			}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
 	 * @param $filter - the filter to add to this chain
109 109
 	 */
110 110
 	public function addNext($filter) {
111
-		if($this->next !== null) {
111
+		if ($this->next !== null) {
112 112
 			$this->next->addNext($filter);
113 113
 		} else {
114 114
 			$this->next = $filter;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerConfigurable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@
 block discarded – undo
92 92
 	/** Setter function for string type. */
93 93
 	protected function setString($property, $value, $nullable = false) {
94 94
 		if ($value === null) {
95
-			if($nullable) {
96
-				$this->$property= null;
95
+			if ($nullable) {
96
+				$this->$property = null;
97 97
 			} else {
98 98
 				$this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
99 99
 			}
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerFilterLevelRange.php 1 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.