@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | /** |
19 | 19 | */ |
20 | -class Logfile extends LogOutputAbstract{ |
|
20 | +class Logfile extends LogOutputAbstract { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var bool|resource |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @throws \chillerlan\Logger\LogException |
33 | 33 | */ |
34 | - public function __construct(ContainerInterface $options = null){ |
|
34 | + public function __construct(ContainerInterface $options = null) { |
|
35 | 35 | parent::__construct($options); |
36 | 36 | |
37 | - if(!is_writable($this->options->logfileDir)){ |
|
37 | + if (!is_writable($this->options->logfileDir)) { |
|
38 | 38 | throw new LogException('log file directory inaccessible'); |
39 | 39 | } |
40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @inheritdoc |
48 | 48 | */ |
49 | - public function __destruct(){ |
|
49 | + public function __destruct() { |
|
50 | 50 | $this->close(); |
51 | 51 | |
52 | - if(gettype($this->fh) === 'resource'){ |
|
52 | + if (gettype($this->fh) === 'resource') { |
|
53 | 53 | fclose($this->fh); |
54 | 54 | } |
55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @inheritdoc |
59 | 59 | */ |
60 | - protected function __log(string $level, string $message, array $context = null){ |
|
60 | + protected function __log(string $level, string $message, array $context = null) { |
|
61 | 61 | fwrite($this->fh, $this->message($level, $message, $context)); |
62 | 62 | } |
63 | 63 |
@@ -23,6 +23,6 @@ |
||
23 | 23 | * @property string $logfileName |
24 | 24 | * @property string $logfileExt |
25 | 25 | */ |
26 | -class LogOptions extends ContainerAbstract{ |
|
26 | +class LogOptions extends ContainerAbstract { |
|
27 | 27 | use LogOptionsTrait; |
28 | 28 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | /** |
21 | 21 | */ |
22 | -class Log implements LoggerInterface{ |
|
22 | +class Log implements LoggerInterface { |
|
23 | 23 | use LoggerTrait; |
24 | 24 | /** |
25 | 25 | * @var \chillerlan\Logger\LogOptions |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * |
36 | 36 | */ |
37 | - public function __destruct(){ |
|
37 | + public function __destruct() { |
|
38 | 38 | $this->close(); |
39 | 39 | } |
40 | 40 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function close():Log{ |
47 | 47 | |
48 | - if(!empty($this->logOutputInterfaces)){ |
|
49 | - foreach($this->logOutputInterfaces as $instanceName => $instance){ |
|
48 | + if (!empty($this->logOutputInterfaces)) { |
|
49 | + foreach ($this->logOutputInterfaces as $instanceName => $instance) { |
|
50 | 50 | unset($this->logOutputInterfaces[$instanceName]); |
51 | 51 | } |
52 | 52 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getInstance(string $instanceName):LogOutputInterface{ |
76 | 76 | |
77 | - if(!array_key_exists($instanceName, $this->logOutputInterfaces)){ |
|
77 | + if (!array_key_exists($instanceName, $this->logOutputInterfaces)) { |
|
78 | 78 | throw new LogException('invalid logger instance: '.$instanceName); |
79 | 79 | } |
80 | 80 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function removeInstance(string $instanceName):Log{ |
91 | 91 | |
92 | - if(!array_key_exists($instanceName, $this->logOutputInterfaces)){ |
|
92 | + if (!array_key_exists($instanceName, $this->logOutputInterfaces)) { |
|
93 | 93 | throw new LogException('invalid logger instance: '.$instanceName); |
94 | 94 | } |
95 | 95 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function log($level, $message, array $context = [], string $instance = null){ |
|
112 | + public function log($level, $message, array $context = [], string $instance = null) { |
|
113 | 113 | |
114 | - foreach($this->logOutputInterfaces as $logger){ |
|
114 | + foreach ($this->logOutputInterfaces as $logger) { |
|
115 | 115 | $logger->log($level, $message, $context); |
116 | 116 | } |
117 | 117 |