@@ -28,11 +28,11 @@ |
||
| 28 | 28 | class Payone_Log4php_LoggerRendererException implements Payone_Log4php_LoggerRendererObject { |
| 29 | 29 | |
| 30 | 30 | public function render($o) { |
| 31 | - $strRep = 'Throwable('.get_class($o).'): '.$o->getMessage().' in '.$o->getFile().' on line '.$o->getLine(); |
|
| 32 | - $strRep .= PHP_EOL.$o->getTraceAsString(); |
|
| 31 | + $strRep = 'Throwable(' . get_class($o) . '): ' . $o->getMessage() . ' in ' . $o->getFile() . ' on line ' . $o->getLine(); |
|
| 32 | + $strRep .= PHP_EOL . $o->getTraceAsString(); |
|
| 33 | 33 | |
| 34 | 34 | if (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) { |
| 35 | - $strRep .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious()); |
|
| 35 | + $strRep .= PHP_EOL . 'Caused by: ' . $this->render($o->getPrevious()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $strRep; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | // Parse the insert patterns; pattern parts are comma delimited |
| 136 | 136 | $pieces = explode(',', $this->insertPattern); |
| 137 | 137 | $converterMap = Payone_Log4php_LoggerLayoutPattern::getDefaultConverterMap(); |
| 138 | - foreach($pieces as $pattern) { |
|
| 138 | + foreach ($pieces as $pattern) { |
|
| 139 | 139 | $parser = new Payone_Log4php_LoggerPatternParser($pattern, $converterMap); |
| 140 | 140 | $this->converters[] = $parser->parse(); |
| 141 | 141 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | @$this->preparedInsert->closeCursor(); |
| 179 | 179 | break; |
| 180 | 180 | } catch (PDOException $e) { |
| 181 | - $this->warn("Failed writing to database: ". $e->getMessage()); |
|
| 181 | + $this->warn("Failed writing to database: " . $e->getMessage()); |
|
| 182 | 182 | |
| 183 | 183 | // Close the appender if it's the last attempt |
| 184 | 184 | if ($attempt == $this->reconnectAttempts) { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | protected function format(Payone_Log4php_LoggerLoggingEvent $event) { |
| 199 | 199 | $params = array(); |
| 200 | - foreach($this->converters as $converter) { |
|
| 200 | + foreach ($this->converters as $converter) { |
|
| 201 | 201 | $buffer = ''; |
| 202 | 202 | while ($converter !== null) { |
| 203 | 203 | $converter->format($buffer, $event); |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | // Parse the option (date format) |
| 54 | 54 | if (isset($this->option)) { |
| 55 | - if(isset($this->specials[$this->option])) { |
|
| 55 | + if (isset($this->specials[$this->option])) { |
|
| 56 | 56 | $this->format = $this->specials[$this->option]; |
| 57 | 57 | } else { |
| 58 | 58 | $this->format = $this->option; |
@@ -43,8 +43,8 @@ |
||
| 43 | 43 | } else { |
| 44 | 44 | $buff = array(); |
| 45 | 45 | $map = $event->getMDCMap(); |
| 46 | - foreach($map as $key => $value) { |
|
| 47 | - $buff []= "$key=$value"; |
|
| 46 | + foreach ($map as $key => $value) { |
|
| 47 | + $buff [] = "$key=$value"; |
|
| 48 | 48 | } |
| 49 | 49 | return implode(', ', $buff); |
| 50 | 50 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function format(Payone_Log4php_LoggerLoggingEvent $event) { |
| 49 | 49 | // If required, initialize the location data |
| 50 | - if($this->locationInfo) { |
|
| 50 | + if ($this->locationInfo) { |
|
| 51 | 51 | $event->getLocationInformation(); |
| 52 | 52 | } |
| 53 | 53 | return serialize($event) . PHP_EOL; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $appenders = array(); |
| 100 | 100 | |
| 101 | - foreach($properties as $key => $value) { |
|
| 101 | + foreach ($properties as $key => $value) { |
|
| 102 | 102 | // Parse loggers |
| 103 | 103 | if ($this->beginsWith($key, self::LOGGER_PREFIX)) { |
| 104 | 104 | $name = substr($key, strlen(self::LOGGER_PREFIX)); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // The remaining values are appender references |
| 151 | 151 | $appenders = array(); |
| 152 | - while($appender = array_shift($parts)) { |
|
| 152 | + while ($appender = array_shift($parts)) { |
|
| 153 | 153 | $appender = trim($appender); |
| 154 | 154 | if (!empty($appender)) { |
| 155 | 155 | $appenders[] = trim($appender); |
@@ -77,8 +77,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -127,7 +127,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -91,26 +91,26 @@ discard block |
||
| 91 | 91 | public function __construct(array $data = array()) |
| 92 | 92 | { |
| 93 | 93 | if (empty($data)) { |
| 94 | - if($this->getApiConfig() === null) |
|
| 94 | + if ($this->getApiConfig() === null) |
|
| 95 | 95 | { |
| 96 | 96 | $this->apiConfig = new Payone_Api_Config(); |
| 97 | 97 | } |
| 98 | - if($this->getTransactionStatusConfig() === null) |
|
| 98 | + if ($this->getTransactionStatusConfig() === null) |
|
| 99 | 99 | { |
| 100 | 100 | $this->transactionStatusConfig = new Payone_TransactionStatus_Config(); |
| 101 | 101 | } |
| 102 | - if($this->getSessionStatusConfig() === null) |
|
| 102 | + if ($this->getSessionStatusConfig() === null) |
|
| 103 | 103 | { |
| 104 | 104 | $this->sessionStatusConfig = new Payone_SessionStatus_Config(); |
| 105 | 105 | } |
| 106 | 106 | $this->config = $this->getDefaultConfigData(); |
| 107 | 107 | } |
| 108 | 108 | else { |
| 109 | - if(array_key_exists('api', $data)) |
|
| 109 | + if (array_key_exists('api', $data)) |
|
| 110 | 110 | $this->setApiConfig($data['api']); |
| 111 | - if(array_key_exists('transaction_status',$data)) |
|
| 111 | + if (array_key_exists('transaction_status', $data)) |
|
| 112 | 112 | $this->setTransactionStatusConfig($data['transaction_status']); |
| 113 | - if(array_key_exists('session_status',$data)) |
|
| 113 | + if (array_key_exists('session_status', $data)) |
|
| 114 | 114 | $this->setSessionStatusConfig($data['session_status']); |
| 115 | 115 | $this->config = $data; |
| 116 | 116 | } |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | // Disassemble key, extracting the first node of the string: |
| 165 | 165 | $explodedKey = explode(self::KEY_SEPARATOR, $key); |
| 166 | 166 | $currentKey = array_shift($explodedKey); |
| 167 | - $newKey = implode(self::KEY_SEPARATOR,$explodedKey); |
|
| 167 | + $newKey = implode(self::KEY_SEPARATOR, $explodedKey); |
|
| 168 | 168 | |
| 169 | 169 | /** @var $object Payone_Config_Abstract */ |
| 170 | 170 | $object = $tree[$currentKey]; |
| 171 | - $object->setValue($newKey,$value); |
|
| 171 | + $object->setValue($newKey, $value); |
|
| 172 | 172 | return TRUE; |
| 173 | 173 | } |
| 174 | 174 | else { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | // Disassemble key, extracting the first node of the string: |
| 201 | 201 | $explodedKey = explode(self::KEY_SEPARATOR, $key); |
| 202 | 202 | $currentKey = array_shift($explodedKey); |
| 203 | - $newKey = implode(self::KEY_SEPARATOR,$explodedKey); |
|
| 203 | + $newKey = implode(self::KEY_SEPARATOR, $explodedKey); |
|
| 204 | 204 | |
| 205 | 205 | /** @var $object Payone_Config_Abstract */ |
| 206 | 206 | $object = $tree[$currentKey]; |