@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * in the logging event. |
| 170 | 170 | */ |
| 171 | 171 | public function log(Payone_Log4php_LoggerLevel $level, $message, $throwable = null) { |
| 172 | - if($this->isEnabledFor($level)) { |
|
| 172 | + if ($this->isEnabledFor($level)) { |
|
| 173 | 173 | $this->forcedLog($this->fqcn, $throwable, $level, $message); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param string $msg message to log |
| 183 | 183 | */ |
| 184 | 184 | public function assertLog($assertion = true, $msg = '') { |
| 185 | - if($assertion == false) { |
|
| 185 | + if ($assertion == false) { |
|
| 186 | 186 | $this->error($msg); |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | /** Removes all appenders from the Logger. */ |
| 287 | 287 | public function removeAllAppenders() { |
| 288 | - foreach($this->appenders as $name => $appender) { |
|
| 288 | + foreach ($this->appenders as $name => $appender) { |
|
| 289 | 289 | $this->removeAppender($name); |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @param mixed $appender an appender name or a {@link Payone_Log4php_LoggerAppender} instance. |
| 296 | 296 | */ |
| 297 | 297 | public function removeAppender($appender) { |
| 298 | - if($appender instanceof Payone_Log4php_LoggerAppender) { |
|
| 298 | + if ($appender instanceof Payone_Log4php_LoggerAppender) { |
|
| 299 | 299 | $appender->close(); |
| 300 | 300 | unset($this->appenders[$appender->getName()]); |
| 301 | 301 | } else if (is_string($appender) and isset($this->appenders[$appender])) { |
@@ -310,12 +310,12 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function callAppenders($event) { |
| 312 | 312 | // Forward the event to each linked appender |
| 313 | - foreach($this->appenders as $appender) { |
|
| 313 | + foreach ($this->appenders as $appender) { |
|
| 314 | 314 | $appender->doAppend($event); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | // Forward the event upstream if additivity is turned on |
| 318 | - if(isset($this->parent) && $this->getAdditivity()) { |
|
| 318 | + if (isset($this->parent) && $this->getAdditivity()) { |
|
| 319 | 319 | $this->parent->callAppenders($event); |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | * @return Payone_Log4php_LoggerLevel or null |
| 359 | 359 | */ |
| 360 | 360 | public function getEffectiveLevel() { |
| 361 | - for($logger = $this; $logger !== null; $logger = $logger->getParent()) { |
|
| 362 | - if($logger->getLevel() !== null) { |
|
| 361 | + for ($logger = $this; $logger !== null; $logger = $logger->getParent()) { |
|
| 362 | + if ($logger->getLevel() !== null) { |
|
| 363 | 363 | return $logger->getLevel(); |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | * @return Payone_Log4php_LoggerHierarchy |
| 422 | 422 | */ |
| 423 | 423 | public static function getHierarchy() { |
| 424 | - if(!isset(self::$hierarchy)) { |
|
| 424 | + if (!isset(self::$hierarchy)) { |
|
| 425 | 425 | self::$hierarchy = new Payone_Log4php_LoggerHierarchy(new Payone_Log4php_LoggerRoot()); |
| 426 | 426 | } |
| 427 | 427 | return self::$hierarchy; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @return Logger |
| 435 | 435 | */ |
| 436 | 436 | public static function getLogger($name) { |
| 437 | - if(!self::isInitialized()) { |
|
| 437 | + if (!self::isInitialized()) { |
|
| 438 | 438 | self::configure(); |
| 439 | 439 | } |
| 440 | 440 | return self::getHierarchy()->getLogger($name); |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * @return Payone_Log4php_LoggerRoot |
| 446 | 446 | */ |
| 447 | 447 | public static function getRootLogger() { |
| 448 | - if(!self::isInitialized()) { |
|
| 448 | + if (!self::isInitialized()) { |
|
| 449 | 449 | self::configure(); |
| 450 | 450 | } |
| 451 | 451 | return self::getHierarchy()->getRootLogger(); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function activateOptions() { |
| 125 | 125 | try { |
| 126 | 126 | $this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port), array("timeout" => $this->timeout)); |
| 127 | - $db = $this->connection->selectDB($this->databaseName); |
|
| 127 | + $db = $this->connection->selectDB($this->databaseName); |
|
| 128 | 128 | if ($this->userName !== null && $this->password !== null) { |
| 129 | 129 | $authResult = $db->authenticate($this->userName, $this->password); |
| 130 | 130 | if ($authResult['ok'] == floatval(0)) { |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | * @return array The array representation of the logging event. |
| 161 | 161 | */ |
| 162 | 162 | protected function format(Payone_Log4php_LoggerLoggingEvent $event) { |
| 163 | - $timestampSec = (int) $event->getTimestamp(); |
|
| 164 | - $timestampUsec = (int) (($event->getTimestamp() - $timestampSec) * 1000000); |
|
| 163 | + $timestampSec = (int)$event->getTimestamp(); |
|
| 164 | + $timestampUsec = (int)(($event->getTimestamp() - $timestampSec) * 1000000); |
|
| 165 | 165 | |
| 166 | 166 | $document = array( |
| 167 | 167 | 'timestamp' => new MongoDate($timestampSec, $timestampUsec), |
| 168 | 168 | 'level' => $event->getLevel()->toString(), |
| 169 | - 'thread' => (int) $event->getThreadName(), |
|
| 169 | + 'thread' => (int)$event->getThreadName(), |
|
| 170 | 170 | 'message' => $event->getMessage(), |
| 171 | 171 | 'loggerName' => $event->getLoggerName() |
| 172 | 172 | ); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | if ($locationInfo != null) { |
| 176 | 176 | $document['fileName'] = $locationInfo->getFileName(); |
| 177 | 177 | $document['method'] = $locationInfo->getMethodName(); |
| 178 | - $document['lineNumber'] = ($locationInfo->getLineNumber() == 'NA') ? 'NA' : (int) $locationInfo->getLineNumber(); |
|
| 178 | + $document['lineNumber'] = ($locationInfo->getLineNumber() == 'NA') ? 'NA' : (int)$locationInfo->getLineNumber(); |
|
| 179 | 179 | $document['className'] = $locationInfo->getClassName(); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * Closes the connection to the logging database |
| 214 | 214 | */ |
| 215 | 215 | public function close() { |
| 216 | - if($this->closed != true) { |
|
| 216 | + if ($this->closed != true) { |
|
| 217 | 217 | $this->collection = null; |
| 218 | 218 | if ($this->connection !== null) { |
| 219 | 219 | $this->connection->close(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function addRenderer($renderedClassName, $renderingClassName) { |
| 66 | 66 | $renderer = Payone_Log4php_LoggerReflectionUtils::createObject($renderingClassName); |
| 67 | - if($renderer == null) { |
|
| 67 | + if ($renderer == null) { |
|
| 68 | 68 | return; |
| 69 | 69 | } else { |
| 70 | 70 | $this->put($renderedClassName, $renderer); |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | 87 | public function findAndRender($o) { |
| 88 | - if($o == null) { |
|
| 88 | + if ($o == null) { |
|
| 89 | 89 | return null; |
| 90 | 90 | } else { |
| 91 | - if(is_object($o)) { |
|
| 91 | + if (is_object($o)) { |
|
| 92 | 92 | $renderer = $this->getByObject($o); |
| 93 | - if($renderer !== null) { |
|
| 93 | + if ($renderer !== null) { |
|
| 94 | 94 | return $renderer->render($o); |
| 95 | 95 | } else { |
| 96 | 96 | return null; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function getByClassName($class) { |
| 127 | 127 | $r = null; |
| 128 | - for($c = $class; !empty($c); $c = get_parent_class($c)) { |
|
| 128 | + for ($c = $class; !empty($c); $c = get_parent_class($c)) { |
|
| 129 | 129 | $c = strtolower($c); |
| 130 | - if(isset($this->map[$c])) { |
|
| 130 | + if (isset($this->map[$c])) { |
|
| 131 | 131 | return $this->map[$c]; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function __construct($level = null) { |
| 35 | 35 | parent::__construct('root'); |
| 36 | 36 | |
| 37 | - if($level == null) { |
|
| 37 | + if ($level == null) { |
|
| 38 | 38 | $level = Payone_Log4php_LoggerLevel::getLevelAll(); |
| 39 | 39 | } |
| 40 | 40 | $this->setLevel($level); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param Payone_Log4php_LoggerLevel $level |
| 53 | 53 | */ |
| 54 | 54 | public function setLevel($level) { |
| 55 | - if($level != null) { |
|
| 55 | + if ($level != null) { |
|
| 56 | 56 | parent::setLevel($level); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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 | } |