@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function __toString() |
| 64 | 64 | { |
| 65 | - if($this->applyFilters) { |
|
| 65 | + if ($this->applyFilters) { |
|
| 66 | 66 | $result = $this->applyFilters->apply($this->toArray()); |
| 67 | 67 | } else { |
| 68 | 68 | $protocolFactory = new Payone_Protocol_Factory(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | foreach ($objectArray as $key => $value) { |
| 79 | 79 | |
| 80 | - if($value instanceof Payone_Api_Response_Parameter_Interface){ |
|
| 80 | + if ($value instanceof Payone_Api_Response_Parameter_Interface) { |
|
| 81 | 81 | $stringArray[] = $this->apply($value->toArray()); |
| 82 | 82 | } elseif ($value !== null) { |
| 83 | 83 | $filter = $this->getFilterConfig($key); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | public function setFilters(array $filters) |
| 121 | 121 | { |
| 122 | 122 | $this->filters = array(); |
| 123 | - foreach($filters as $key => /** @var $value Payone_Protocol_Filter_Interface */ $value) |
|
| 123 | + foreach ($filters as $key => /** @var $value Payone_Protocol_Filter_Interface */ $value) |
|
| 124 | 124 | { |
| 125 | 125 | $this->addFilter($value); |
| 126 | 126 | } |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function getFilterConfig($key) |
| 155 | 155 | { |
| 156 | - foreach($this->filters_config as $filter => $config) { |
|
| 157 | - if(in_array($key, $config)) { |
|
| 156 | + foreach ($this->filters_config as $filter => $config) { |
|
| 157 | + if (in_array($key, $config)) { |
|
| 158 | 158 | return $this->getFilter($filter); |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -42,9 +42,9 @@ |
||
| 42 | 42 | class Payone_Log4php_LoggerAppenderPhp extends Payone_Log4php_LoggerAppender { |
| 43 | 43 | |
| 44 | 44 | public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
| 45 | - if($this->layout !== null) { |
|
| 45 | + if ($this->layout !== null) { |
|
| 46 | 46 | $level = $event->getLevel(); |
| 47 | - if($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelError())) { |
|
| 47 | + if ($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelError())) { |
|
| 48 | 48 | trigger_error($this->layout->format($event), E_USER_ERROR); |
| 49 | 49 | } else if ($level->isGreaterOrEqual(Payone_Log4php_LoggerLevel::getLevelWarn())) { |
| 50 | 50 | trigger_error($this->layout->format($event), E_USER_WARNING); |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | // When the key is not set, display all values |
| 87 | 87 | else { |
| 88 | 88 | $values = array(); |
| 89 | - foreach($source as $key => $value) { |
|
| 89 | + foreach ($source as $key => $value) { |
|
| 90 | 90 | $values[] = "$key=$value"; |
| 91 | 91 | } |
| 92 | 92 | $this->value = implode(', ', $values); |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | if ($this->locationInfo) { |
| 150 | 150 | $locInfo = $event->getLocationInformation(); |
| 151 | 151 | $sbuf .= "<td>"; |
| 152 | - $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber(); |
|
| 152 | + $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES) . ':' . $locInfo->getLineNumber(); |
|
| 153 | 153 | $sbuf .= "</td>" . PHP_EOL; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -77,11 +77,11 @@ |
||
| 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; |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | public function setProperties($properties, $prefix) { |
| 70 | 70 | $len = strlen($prefix); |
| 71 | 71 | reset($properties); |
| 72 | - while(list($key,) = each($properties)) { |
|
| 73 | - if(strpos($key, $prefix) === 0) { |
|
| 74 | - if(strpos($key, '.', ($len + 1)) > 0) { |
|
| 72 | + while (list($key,) = each($properties)) { |
|
| 73 | + if (strpos($key, $prefix) === 0) { |
|
| 74 | + if (strpos($key, '.', ($len + 1)) > 0) { |
|
| 75 | 75 | continue; |
| 76 | 76 | } |
| 77 | 77 | $value = Payone_Log4php_LoggerOptionConverter::findAndSubst($key, $properties); |
| 78 | 78 | $key = substr($key, $len); |
| 79 | - if($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) { |
|
| 79 | + if ($key == 'layout' and ($this->obj instanceof Payone_Log4php_LoggerAppender)) { |
|
| 80 | 80 | continue; |
| 81 | 81 | } |
| 82 | 82 | $this->setProperty($key, $value); |
@@ -101,21 +101,21 @@ discard block |
||
| 101 | 101 | * @param string $value String value of the property |
| 102 | 102 | */ |
| 103 | 103 | public function setProperty($name, $value) { |
| 104 | - if($value === null) { |
|
| 104 | + if ($value === null) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $method = "set" . ucfirst($name); |
| 109 | 109 | |
| 110 | - if(!method_exists($this->obj, $method)) { |
|
| 111 | - throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!"); |
|
| 110 | + if (!method_exists($this->obj, $method)) { |
|
| 111 | + throw new Exception("Error setting log4php property $name to $value: no method $method in class " . get_class($this->obj) . "!"); |
|
| 112 | 112 | } else { |
| 113 | 113 | return call_user_func(array($this->obj, $method), $value); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function activate() { |
| 118 | - if(method_exists($this->obj, 'activateoptions')) { |
|
| 118 | + if (method_exists($this->obj, 'activateoptions')) { |
|
| 119 | 119 | return call_user_func(array($this->obj, 'activateoptions')); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return an object from the class with the given classname |
| 128 | 128 | */ |
| 129 | 129 | public static function createObject($class) { |
| 130 | - if(!empty($class)) { |
|
| 130 | + if (!empty($class)) { |
|
| 131 | 131 | return new $class(); |
| 132 | 132 | } |
| 133 | 133 | return null; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (empty($name)) { |
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | - $methodName = 'set'.ucfirst($name); |
|
| 145 | + $methodName = 'set' . ucfirst($name); |
|
| 146 | 146 | if (method_exists($object, $methodName)) { |
| 147 | 147 | return call_user_func(array($object, $methodName), $value); |
| 148 | 148 | } else { |
@@ -168,24 +168,24 @@ |
||
| 168 | 168 | $format .= ' '; |
| 169 | 169 | |
| 170 | 170 | if ($this->threadPrinting) { |
| 171 | - $format .= '['.getmypid().'] '; |
|
| 171 | + $format .= '[' . getmypid() . '] '; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $level = $event->getLevel(); |
| 175 | - $format .= $level.' '; |
|
| 175 | + $format .= $level . ' '; |
|
| 176 | 176 | |
| 177 | - if($this->categoryPrefixing) { |
|
| 178 | - $format .= $event->getLoggerName().' '; |
|
| 177 | + if ($this->categoryPrefixing) { |
|
| 178 | + $format .= $event->getLoggerName() . ' '; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($this->contextPrinting) { |
|
| 181 | + if ($this->contextPrinting) { |
|
| 182 | 182 | $ndc = $event->getNDC(); |
| 183 | - if($ndc != null) { |
|
| 184 | - $format .= $ndc.' '; |
|
| 183 | + if ($ndc != null) { |
|
| 184 | + $format .= $ndc . ' '; |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $format .= '- '.$event->getRenderedMessage(); |
|
| 188 | + $format .= '- ' . $event->getRenderedMessage(); |
|
| 189 | 189 | $format .= PHP_EOL; |
| 190 | 190 | |
| 191 | 191 | return $format; |