Completed
Push — master ( 2a4a7d...a103b7 )
by Florian
04:57
created
lib/Payone/Config/Abstract.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -77,8 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         if (empty($data)) {
79 79
             $this->config = $this->getDefaultConfigData();
80
-        }
81
-        else {
80
+        } else {
82 81
             $this->config = $data;
83 82
         }
84 83
     }
@@ -127,8 +126,7 @@  discard block
 block discarded – undo
127 126
             // Start recursion:
128 127
             return $this->set($newKey, $value, $tree[$currentKey]);
129 128
 
130
-        }
131
-        else {
129
+        } else {
132 130
             // Set value (can overwrite an existing value)
133 131
             $tree[$key] = $value;
134 132
             // Exit recursion, Success!
@@ -166,16 +164,13 @@  discard block
 block discarded – undo
166 164
                 // Reassemble key, start recursion:
167 165
                 $newKey = implode(self::KEY_SEPARATOR, $explodedKey);
168 166
                 return $this->get($newKey, $newTree);
169
-            }
170
-            else {
167
+            } else {
171 168
                 return NULL; // Exit recursion, unsuccessful
172 169
             }
173 170
 
174
-        }
175
-        elseif (is_array($tree) and array_key_exists($key, $tree)) {
171
+        } elseif (is_array($tree) and array_key_exists($key, $tree)) {
176 172
             return $tree[$key]; // Exit recursion, Success!
177
-        }
178
-        else {
173
+        } else {
179 174
             return NULL; // Exit recursion, unsuccessful
180 175
         }
181 176
     }
Please login to merge, or discard this patch.
lib/Payone/Settings/Data/ConfigFile/Shop/ClearingTypes.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
             if ($value instanceof Payone_Settings_Data_ConfigFile_Interface) {
59 59
                 /** @var Payone_Api_Request_Parameter_Interface $value */
60 60
                 $array[$value->getKey()] = $value->toArray();
61
-            }
62
-            else {
61
+            } else {
63 62
                 $array[$key] = $value;
64 63
             }
65 64
         }
Please login to merge, or discard this patch.
lib/Payone/Settings/Data/ConfigFile/Abstract.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,21 +50,18 @@
 block discarded – undo
50 50
             if ($data instanceof Payone_Settings_Data_ConfigFile_Interface) {
51 51
                 /** @var Payone_Api_Request_Parameter_Interface $data */
52 52
                 $array[$key] = $data->toArray();
53
-            }
54
-            elseif (is_array($data))
53
+            } elseif (is_array($data))
55 54
             {
56 55
                 foreach ($data as $innerKey => $innerValue)
57 56
                 {
58 57
                     if ($innerValue instanceof Payone_Settings_Data_ConfigFile_Interface) {
59 58
                         /** @var Payone_Api_Request_Parameter_Interface $innerValue */
60 59
                         $array[$key][$innerValue->getKey()] = $innerValue->toArray();
61
-                    }
62
-                    else {
60
+                    } else {
63 61
                         $array[$key][$innerKey] = $innerValue;
64 62
                     }
65 63
                 }
66
-            }
67
-            else {
64
+            } else {
68 65
                 $array[$key] = $data;
69 66
             }
70 67
         }
Please login to merge, or discard this patch.
lib/Payone/Settings/Data/ConfigFile/PaymentMethod/CashOnDelivery.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,8 @@
 block discarded – undo
143 143
     }
144 144
 
145 145
     /**
146
-         * @return string
147
-         */
146
+     * @return string
147
+     */
148 148
         public function getKey()
149 149
         {
150 150
             return $this->key;
Please login to merge, or discard this patch.
lib/Payone/Settings/Service/XmlGenerate.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -109,12 +109,10 @@  discard block
 block discarded – undo
109 109
                     foreach ($value['attribute'] as $attributKey => $attributData) {
110 110
                         $node->addAttribute($attributKey, $attributData);
111 111
                     }
112
-                }
113
-                else {
112
+                } else {
114 113
                     $this->simpleXmlFromNestedArray($key, $value, $parent);
115 114
                 }
116
-            }
117
-            else {
115
+            } else {
118 116
                 $parent->addChild($key, $value);
119 117
             }
120 118
 
@@ -415,8 +413,7 @@  discard block
 block discarded – undo
415 413
             foreach ($data as $key => $value) {
416 414
                 $child = $this->appendElement($parentNode, $key, $value, $withCdata);
417 415
             }
418
-        }
419
-        else {
416
+        } else {
420 417
             if (isset($data)) {
421 418
                 $child = $this->appendElement($parent, $property, $data, $withCdata);
422 419
             }
@@ -436,8 +433,7 @@  discard block
 block discarded – undo
436 433
             foreach ($value as $key => $data) {
437 434
                 $mapNode->setAttribute($key, $data);
438 435
             }
439
-        }
440
-        else {
436
+        } else {
441 437
             if (!empty($data)) {
442 438
                 $mapNode->setAttribute($name, $value);
443 439
             }
@@ -459,8 +455,7 @@  discard block
 block discarded – undo
459 455
             $cdata = $this->dom->createCDATASection($value);
460 456
             $child = $this->dom->createElement($key);
461 457
             $child->appendChild($cdata);
462
-        }
463
-        else
458
+        } else
464 459
         {
465 460
             $child = $this->dom->createElement($key);
466 461
             if($value !== null)
Please login to merge, or discard this patch.
lib/Payone/ClientApi/Request/Abstract.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,8 +187,7 @@
 block discarded – undo
187 187
 
188 188
                 return $object->get($propertyName);
189 189
             }
190
-        }
191
-        elseif (property_exists($this, $name)) {
190
+        } elseif (property_exists($this, $name)) {
192 191
             return $this->$name;
193 192
         }
194 193
         return null;
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerHierarchy.php 1 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.
lib/Payone/Log4php/LoggerAppenderPhp.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@
 block discarded – undo
41 41
  */ 
42 42
 class Payone_Log4php_LoggerAppenderPhp extends Payone_Log4php_LoggerAppender {
43 43
 
44
-	public function append(Payone_Log4php_LoggerLoggingEvent $event) {
45
-		if($this->layout !== null) {
46
-			$level = $event->getLevel();
47
-			if($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelError())) {
48
-				trigger_error($this->layout->format($event), E_USER_ERROR);
49
-			} else if ($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelWarn())) {
50
-				trigger_error($this->layout->format($event), E_USER_WARNING);
51
-			} else {
52
-				trigger_error($this->layout->format($event), E_USER_NOTICE);
53
-			}
54
-		}
55
-	}
44
+    public function append(Payone_Log4php_LoggerLoggingEvent $event) {
45
+        if($this->layout !== null) {
46
+            $level = $event->getLevel();
47
+            if($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelError())) {
48
+                trigger_error($this->layout->format($event), E_USER_ERROR);
49
+            } else if ($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelWarn())) {
50
+                trigger_error($this->layout->format($event), E_USER_WARNING);
51
+            } else {
52
+                trigger_error($this->layout->format($event), E_USER_NOTICE);
53
+            }
54
+        }
55
+    }
56 56
 }
Please login to merge, or discard this patch.
lib/Payone/Log4php/LoggerRendererDefault.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@
 block discarded – undo
39 39
  */
40 40
 class Payone_Log4php_LoggerRendererDefault implements Payone_Log4php_LoggerRendererObject {
41 41
 
42
-	/**
43
-	 * Render objects by type casting
44
-	 *
45
-	 * @param mixed $o the object to render
46
-	 * @return string
47
-	 */
48
-	public function render($o) {
49
-		return var_export($o, true);
50
-	}
42
+    /**
43
+     * Render objects by type casting
44
+     *
45
+     * @param mixed $o the object to render
46
+     * @return string
47
+     */
48
+    public function render($o) {
49
+        return var_export($o, true);
50
+    }
51 51
 }
Please login to merge, or discard this patch.