@@ -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; |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | protected $body = ''; |
| 71 | 71 | |
| 72 | 72 | public function close() { |
| 73 | - if($this->closed != true) { |
|
| 73 | + if ($this->closed != true) { |
|
| 74 | 74 | $from = $this->from; |
| 75 | 75 | $to = $this->to; |
| 76 | 76 | |
| 77 | - if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 77 | + if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 78 | 78 | $subject = $this->subject; |
| 79 | - if(!$this->dry) { |
|
| 79 | + if (!$this->dry) { |
|
| 80 | 80 | mail( |
| 81 | 81 | $to, $subject, |
| 82 | 82 | $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
| 83 | 83 | "From: {$from}\r\n"); |
| 84 | 84 | } else { |
| 85 | - echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body; |
|
| 85 | + echo "DRY MODE OF MAIL APP.: Send mail to: " . $to . " with content: " . $this->body; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | $this->closed = true; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
| 109 | - if($this->layout !== null) { |
|
| 109 | + if ($this->layout !== null) { |
|
| 110 | 110 | $this->body .= $this->layout->format($event); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -94,8 +94,8 @@ discard block |
||
| 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 |
||
| 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 { |
@@ -83,17 +83,17 @@ |
||
| 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()); |
@@ -41,7 +41,7 @@ |
||
| 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 | |