@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | */ |
| 20 | -class Log implements LoggerInterface{ |
|
| 20 | +class Log implements LoggerInterface { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var \chillerlan\Logger\LogOptions |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * |
| 34 | 34 | */ |
| 35 | - public function __destruct(){ |
|
| 35 | + public function __destruct() { |
|
| 36 | 36 | $this->close(); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function close():Log{ |
| 45 | 45 | |
| 46 | - if(!empty($this->instances)){ |
|
| 47 | - foreach($this->instances as $instanceName => $instance){ |
|
| 46 | + if (!empty($this->instances)) { |
|
| 47 | + foreach ($this->instances as $instanceName => $instance) { |
|
| 48 | 48 | unset($this->instances[$instanceName]); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getInstance(string $instanceName):LogOutputInterface{ |
| 74 | 74 | |
| 75 | - if(!array_key_exists($instanceName, $this->instances)){ |
|
| 75 | + if (!array_key_exists($instanceName, $this->instances)) { |
|
| 76 | 76 | throw new LogException('invalid logger instance: '.$instanceName); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function removeInstance(string $instanceName):Log{ |
| 89 | 89 | |
| 90 | - if(!array_key_exists($instanceName, $this->instances)){ |
|
| 90 | + if (!array_key_exists($instanceName, $this->instances)) { |
|
| 91 | 91 | throw new LogException('invalid logger instance: '.$instanceName); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return void |
| 107 | 107 | */ |
| 108 | - public function log($level, $message, array $context = []){ |
|
| 108 | + public function log($level, $message, array $context = []) { |
|
| 109 | 109 | |
| 110 | - foreach($this->instances as $logger){ |
|
| 110 | + foreach ($this->instances as $logger) { |
|
| 111 | 111 | $logger->log($level, $message, $context); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return void |
| 123 | 123 | */ |
| 124 | - public function emergency($message, array $context = []){ |
|
| 124 | + public function emergency($message, array $context = []) { |
|
| 125 | 125 | $this->log(LogLevel::EMERGENCY, $message, $context); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - public function alert($message, array $context = []){ |
|
| 139 | + public function alert($message, array $context = []) { |
|
| 140 | 140 | $this->log(LogLevel::ALERT, $message, $context); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | - public function critical($message, array $context = []){ |
|
| 153 | + public function critical($message, array $context = []) { |
|
| 154 | 154 | $this->log(LogLevel::CRITICAL, $message, $context); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | - public function error($message, array $context = []){ |
|
| 166 | + public function error($message, array $context = []) { |
|
| 167 | 167 | $this->log(LogLevel::ERROR, $message, $context); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return void |
| 180 | 180 | */ |
| 181 | - public function warning($message, array $context = []){ |
|
| 181 | + public function warning($message, array $context = []) { |
|
| 182 | 182 | $this->log(LogLevel::WARNING, $message, $context); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return void |
| 192 | 192 | */ |
| 193 | - public function notice($message, array $context = []){ |
|
| 193 | + public function notice($message, array $context = []) { |
|
| 194 | 194 | $this->log(LogLevel::NOTICE, $message, $context); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return void |
| 206 | 206 | */ |
| 207 | - public function info($message, array $context = []){ |
|
| 207 | + public function info($message, array $context = []) { |
|
| 208 | 208 | $this->log(LogLevel::INFO, $message, $context); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @return void |
| 218 | 218 | */ |
| 219 | - public function debug($message, array $context = []){ |
|
| 219 | + public function debug($message, array $context = []) { |
|
| 220 | 220 | $this->log(LogLevel::DEBUG, $message, $context); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | */ |
| 17 | -class Logfile extends ConsoleLog{ |
|
| 17 | +class Logfile extends ConsoleLog { |
|
| 18 | 18 | |
| 19 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 19 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 20 | 20 | $data = $this->message($level, $message, $context); |
| 21 | 21 | // ... @todo |
| 22 | 22 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | */ |
| 19 | -interface LogOutputInterface{ |
|
| 19 | +interface LogOutputInterface { |
|
| 20 | 20 | |
| 21 | 21 | const E_NULL = 0x00; |
| 22 | 22 | const E_ALL = 0xff; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | */ |
| 20 | -class EmailLog extends LogOutputAbstract{ |
|
| 20 | +class EmailLog extends LogOutputAbstract { |
|
| 21 | 21 | |
| 22 | 22 | protected $mailer; |
| 23 | 23 | |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * @param \chillerlan\Logger\LogOptions $options |
| 29 | 29 | * @param \PHPMailer\PHPMailer\PHPMailer $mailer |
| 30 | 30 | */ |
| 31 | - public function __construct(LogOptions $options, PHPMailer $mailer){ |
|
| 31 | + public function __construct(LogOptions $options, PHPMailer $mailer) { |
|
| 32 | 32 | $this->options = $options; |
| 33 | 33 | $this->mailer = $mailer; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 36 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 37 | 37 | // TODO: Implement log() method. |
| 38 | 38 | } |
| 39 | 39 | |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | */ |
| 17 | -class ServerErrorlog extends LogOutputAbstract{ |
|
| 17 | +class ServerErrorlog extends LogOutputAbstract { |
|
| 18 | 18 | |
| 19 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 19 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 20 | 20 | // TODO: Implement log() method. |
| 21 | 21 | } |
| 22 | 22 | |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | * is a good way to avoid littering your code with `if ($this->logger) { }` |
| 21 | 21 | * blocks. |
| 22 | 22 | */ |
| 23 | -class NullLogger extends LogOutputAbstract{ |
|
| 23 | +class NullLogger extends LogOutputAbstract { |
|
| 24 | 24 | |
| 25 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 25 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 26 | 26 | // go along, nothing to see here. |
| 27 | 27 | } |
| 28 | 28 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | */ |
| 20 | -class DatabaseLog extends LogOutputAbstract{ |
|
| 20 | +class DatabaseLog extends LogOutputAbstract { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var \chillerlan\Database\Connection |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | * @param \chillerlan\Logger\LogOptions $options |
| 32 | 32 | * @param \chillerlan\Database\Connection $db |
| 33 | 33 | */ |
| 34 | - public function __construct(LogOptions $options, Connection $db){ |
|
| 34 | + public function __construct(LogOptions $options, Connection $db) { |
|
| 35 | 35 | $this->options = $options; |
| 36 | 36 | $this->db = $db; |
| 37 | 37 | |
| 38 | 38 | $this->db->connect(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 41 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 42 | 42 | // TODO: Implement log() method. |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | */ |
| 19 | -class Syslog extends LogOutputAbstract{ |
|
| 19 | +class Syslog extends LogOutputAbstract { |
|
| 20 | 20 | |
| 21 | 21 | const syslogLevels = [ |
| 22 | 22 | LogLevel::DEBUG => LOG_DEBUG, |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | LogLevel::EMERGENCY => LOG_EMERG, |
| 30 | 30 | ]; |
| 31 | 31 | |
| 32 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 32 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 33 | 33 | syslog($this::syslogLevels[$level], $message); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | */ |
| 17 | -class ConsoleLog extends LogOutputAbstract{ |
|
| 17 | +class ConsoleLog extends LogOutputAbstract { |
|
| 18 | 18 | |
| 19 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 19 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 20 | 20 | echo $this->message($level, $message, $context); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - protected function message(string $level, string $message, array $context = null){ |
|
| 29 | + protected function message(string $level, string $message, array $context = null) { |
|
| 30 | 30 | return sprintf($this->options->consoleFormat, date($this->options->consoleDateFormat), $level, $message).PHP_EOL; |
| 31 | 31 | } |
| 32 | 32 | } |