| Conditions | 11 |
| Paths | 232 |
| Total Lines | 37 |
| Code Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 35 | public function write($exception, $logType) |
||
| 36 | { |
||
| 37 | try { |
||
| 38 | $log = new Log(); |
||
| 39 | if(is_callable($this->context)) { |
||
| 40 | try { |
||
| 41 | $this->context = call_user_func($this->context, $exception); |
||
| 42 | } catch(\Exception $e) { |
||
| 43 | self::logInnerException(new \Exception('Can not call ' . (string) $this->context)); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | if(!is_array($this->context)) { |
||
| 47 | $this->context = (!empty($this->context) ? [$this->context] : []); |
||
| 48 | } |
||
| 49 | if($logType == \Bitrix\Main\Diag\ExceptionHandlerLog::LOW_PRIORITY_ERROR) { |
||
| 50 | $log->error($exception, $this->context); |
||
| 51 | } else { |
||
| 52 | $telegramBlocked = false; |
||
| 53 | if($_ENV['APP_LOG_NO_TELEGRAM']) { |
||
| 54 | $blockStrings = explode('|', $_ENV['APP_LOG_NO_TELEGRAM']); |
||
| 55 | foreach($blockStrings as $blockString) { |
||
| 56 | if(stripos($exception, $blockString) !== false) { |
||
| 57 | $telegramBlocked = true; |
||
| 58 | break; |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | if($telegramBlocked) { |
||
| 63 | $log->error($exception, $this->context); |
||
| 64 | } else { |
||
| 65 | $this->context['source'] = self::logTypeToString($logType); |
||
| 66 | $log->telegram(LogLevel::CRITICAL, $exception, $this->context); |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | } catch(\Exception $e) { |
||
| 71 | self::logInnerException($e); |
||
| 72 | } |
||
| 82 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths