@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function get() |
| 110 | 110 | { |
| 111 | - return empty( $this->log ) |
|
| 111 | + return empty($this->log) |
|
| 112 | 112 | ? __( 'Log is empty', 'site-reviews' ) |
| 113 | 113 | : $this->log; |
| 114 | 114 | } |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | public function humanSize( $valueIfEmpty = null ) |
| 121 | 121 | { |
| 122 | 122 | $bytes = $this->size(); |
| 123 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
| 123 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
| 124 | 124 | return $valueIfEmpty; |
| 125 | 125 | } |
| 126 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
| 127 | - return round( $bytes / pow( 1024, $exponent ), 2 ).['B','KB','MB','GB'][$exponent]; |
|
| 126 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
| 127 | + return round( $bytes / pow( 1024, $exponent ), 2 ).['B', 'KB', 'MB', 'GB'][$exponent]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
| 150 | 150 | $constants = (array)apply_filters( 'site-reviews/log-levels', $constants ); |
| 151 | - if( in_array( $level, $constants, true )) { |
|
| 151 | + if( in_array( $level, $constants, true ) ) { |
|
| 152 | 152 | $entry = $this->buildLogEntry( $level, $message, $context ); |
| 153 | - file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX ); |
|
| 153 | + file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX ); |
|
| 154 | 154 | $this->reset(); |
| 155 | 155 | } |
| 156 | 156 | return $this; |
@@ -210,15 +210,15 @@ discard block |
||
| 210 | 210 | protected function getDebugInformation() |
| 211 | 211 | { |
| 212 | 212 | $caller = debug_backtrace( 0, 6 ); |
| 213 | - $index = array_search( 'log', array_column( $caller, 'function' )); |
|
| 213 | + $index = array_search( 'log', array_column( $caller, 'function' ) ); |
|
| 214 | 214 | if( $index === false |
| 215 | - || !isset( $caller[$index+2]['class'] ) |
|
| 216 | - || !isset( $caller[$index+2]['function'] ) |
|
| 215 | + || !isset($caller[$index + 2]['class']) |
|
| 216 | + || !isset($caller[$index + 2]['function']) |
|
| 217 | 217 | )return; |
| 218 | 218 | return sprintf( '[%s()->%s:%s] ', |
| 219 | - $caller[$index+2]['class'], |
|
| 220 | - $caller[$index+2]['function'], |
|
| 221 | - $caller[$index+1]['line'] |
|
| 219 | + $caller[$index + 2]['class'], |
|
| 220 | + $caller[$index + 2]['function'], |
|
| 221 | + $caller[$index + 1]['line'] |
|
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | protected function interpolate( $message, $context = [] ) |
| 232 | 232 | { |
| 233 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
| 233 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
| 234 | 234 | return print_r( $message, true ); |
| 235 | 235 | } |
| 236 | 236 | $replace = []; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if( $value instanceof DateTime ) { |
| 259 | 259 | $value = $value->format( 'Y-m-d H:i:s' ); |
| 260 | 260 | } |
| 261 | - else if( $this->isObjectOrArray( $value )) { |
|
| 261 | + else if( $this->isObjectOrArray( $value ) ) { |
|
| 262 | 262 | $value = json_encode( $value ); |
| 263 | 263 | } |
| 264 | 264 | return (string)$value; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $this->clear(); |
| 274 | 274 | file_put_contents( |
| 275 | 275 | $this->file, |
| 276 | - $this->buildLogEntry( 'info', __( 'Log has been automatically reset (512 KB max size)', 'site-reviews' )) |
|
| 276 | + $this->buildLogEntry( 'info', __( 'Log has been automatically reset (512 KB max size)', 'site-reviews' ) ) |
|
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | } |