@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct($path) |
| 32 | 32 | { |
| 33 | - $this->path = $this->fixDirectorySeparator($path); |
|
| 33 | + $this->path = $this->fixDirectorySeparator($path); |
|
| 34 | 34 | if ($this->exists()) { |
| 35 | 35 | $this->path = realpath($this->path); |
| 36 | 36 | } |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | private function fixDirectorySeparator($path) |
| 201 | 201 | { |
| 202 | - $path = str_replace("\\", DIRECTORY_SEPARATOR , $path); |
|
| 203 | - $path = str_replace("/", DIRECTORY_SEPARATOR, $path); |
|
| 202 | + $path = str_replace("\\", DIRECTORY_SEPARATOR , $path); |
|
| 203 | + $path = str_replace("/", DIRECTORY_SEPARATOR, $path); |
|
| 204 | 204 | |
| 205 | - return $path; |
|
| 205 | + return $path; |
|
| 206 | 206 | } |
| 207 | 207 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | trait DumpLoggerTrait |
| 16 | 16 | { |
| 17 | - abstract public function debug($message, array $context = array()); |
|
| 17 | + abstract public function debug($message, array $context = array()); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * {@inheritDoc} |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | trait ExceptionLoggerTrait |
| 18 | 18 | { |
| 19 | - abstract protected function logImpl($level, $message, array $context = array()); |
|
| 19 | + abstract protected function logImpl($level, $message, array $context = array()); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * {@inheritDoc} |
@@ -472,6 +472,6 @@ |
||
| 472 | 472 | */ |
| 473 | 473 | public function isOpen() |
| 474 | 474 | { |
| 475 | - return true; |
|
| 475 | + return true; |
|
| 476 | 476 | } |
| 477 | 477 | } |
@@ -49,6 +49,6 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function __construct($message, array $context = array(), $code = 0, Exception $previous = null) |
| 51 | 51 | { |
| 52 | - parent::__construct($message, $context, $code, $previous); |
|
| 52 | + parent::__construct($message, $context, $code, $previous); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -8,24 +8,24 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | abstract class BasicLogger extends AbstractLogger |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * The level threshold where to log |
|
| 13 | - * |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - private $level; |
|
| 11 | + /** |
|
| 12 | + * The level threshold where to log |
|
| 13 | + * |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + private $level; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Set the log level threshold |
|
| 20 | - * |
|
| 21 | - * @param string $level |
|
| 22 | - * @return BasicLogger |
|
| 23 | - */ |
|
| 24 | - public function setLevel(string $level):BasicLogger |
|
| 25 | - { |
|
| 26 | - $this->level = $level; |
|
| 27 | - return $this; |
|
| 28 | - } |
|
| 18 | + /** |
|
| 19 | + * Set the log level threshold |
|
| 20 | + * |
|
| 21 | + * @param string $level |
|
| 22 | + * @return BasicLogger |
|
| 23 | + */ |
|
| 24 | + public function setLevel(string $level):BasicLogger |
|
| 25 | + { |
|
| 26 | + $this->level = $level; |
|
| 27 | + return $this; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Checks the given level |
@@ -89,32 +89,32 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function log($level, $message, array $context = array()) |
| 91 | 91 | { |
| 92 | - if( $this->levelHasReached($level) ) { |
|
| 93 | - $this->logImpl($level, $message, $context); |
|
| 94 | - } |
|
| 92 | + if( $this->levelHasReached($level) ) { |
|
| 93 | + $this->logImpl($level, $message, $context); |
|
| 94 | + } |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | protected function levelHasReached($level):bool |
| 98 | 98 | { |
| 99 | - $result = true; |
|
| 99 | + $result = true; |
|
| 100 | 100 | |
| 101 | - $orderedLevels = array( |
|
| 102 | - LogLevel::EMERGENCY => 0, |
|
| 103 | - LogLevel::ALERT => 1, |
|
| 104 | - LogLevel::CRITICAL => 2, |
|
| 105 | - LogLevel::ERROR => 3, |
|
| 106 | - LogLevel::WARNING => 4, |
|
| 107 | - LogLevel::NOTICE => 5, |
|
| 108 | - LogLevel::INFO => 6, |
|
| 109 | - LogLevel::DEBUG => 7 |
|
| 110 | - ); |
|
| 101 | + $orderedLevels = array( |
|
| 102 | + LogLevel::EMERGENCY => 0, |
|
| 103 | + LogLevel::ALERT => 1, |
|
| 104 | + LogLevel::CRITICAL => 2, |
|
| 105 | + LogLevel::ERROR => 3, |
|
| 106 | + LogLevel::WARNING => 4, |
|
| 107 | + LogLevel::NOTICE => 5, |
|
| 108 | + LogLevel::INFO => 6, |
|
| 109 | + LogLevel::DEBUG => 7 |
|
| 110 | + ); |
|
| 111 | 111 | |
| 112 | - if ( $this->level ) { |
|
| 113 | - $threshold = $orderedLevels[$this->level]; |
|
| 114 | - $reached = $orderedLevels[$level]; |
|
| 115 | - $result = $reached <= $threshold; |
|
| 116 | - } |
|
| 112 | + if ( $this->level ) { |
|
| 113 | + $threshold = $orderedLevels[$this->level]; |
|
| 114 | + $reached = $orderedLevels[$level]; |
|
| 115 | + $result = $reached <= $threshold; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return $result; |
|
| 118 | + return $result; |
|
| 119 | 119 | } |
| 120 | 120 | } |
@@ -65,9 +65,9 @@ |
||
| 65 | 65 | */ |
| 66 | 66 | protected function logImpl($level, $message, array $context = array()) |
| 67 | 67 | { |
| 68 | - if (!$this->levelHasReached($level)) { |
|
| 69 | - return; |
|
| 70 | - } |
|
| 68 | + if (!$this->levelHasReached($level)) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | if ($this->isRotationNeeded()) { |
| 73 | 73 | unlink($this->file); |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | private function open() |
| 54 | 54 | { |
| 55 | - $this->handle = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
|
| 55 | + $this->handle = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
|
| 56 | 56 | |
| 57 | - if (! is_resource($this->handle)) { |
|
| 58 | - $code = socket_last_error(); |
|
| 59 | - throw new SocketException(socket_strerror($code), array(), $code); |
|
| 60 | - } |
|
| 57 | + if (! is_resource($this->handle)) { |
|
| 58 | + $code = socket_last_error(); |
|
| 59 | + throw new SocketException(socket_strerror($code), array(), $code); |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $code = socket_last_error(); |
| 169 | 169 | if ($code != 0) { |
| 170 | 170 | if ($code != 10053) { |
| 171 | - throw new SocketException(socket_strerror($code), array(), $code); |
|
| 171 | + throw new SocketException(socket_strerror($code), array(), $code); |
|
| 172 | 172 | } else { |
| 173 | 173 | $this->handle = null; |
| 174 | 174 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function isOpen() |
| 224 | 224 | { |
| 225 | - return is_resource($this->handle); |
|
| 225 | + return is_resource($this->handle); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function reset() |
| 233 | 233 | { |
| 234 | - try { |
|
| 235 | - $this->close(); |
|
| 236 | - $this->open(); |
|
| 237 | - } |
|
| 238 | - catch(Exception $ex) |
|
| 239 | - { |
|
| 240 | - throw new ResetException($ex->getMessage(), array(), $ex->getCode(), $ex); |
|
| 241 | - } |
|
| 234 | + try { |
|
| 235 | + $this->close(); |
|
| 236 | + $this->open(); |
|
| 237 | + } |
|
| 238 | + catch(Exception $ex) |
|
| 239 | + { |
|
| 240 | + throw new ResetException($ex->getMessage(), array(), $ex->getCode(), $ex); |
|
| 241 | + } |
|
| 242 | 242 | } |
| 243 | 243 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function isLocked():bool |
| 171 | 171 | { |
| 172 | - return $this->locked; |
|
| 172 | + return $this->locked; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -188,6 +188,6 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function isOpen() |
| 190 | 190 | { |
| 191 | - return is_resource($this->handle); |
|
| 191 | + return is_resource($this->handle); |
|
| 192 | 192 | } |
| 193 | 193 | } |