| Conditions | 15 |
| Paths | 180 |
| Total Lines | 45 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 66 | public static function init (array|stdClass $settings): void { |
||
| 67 | $settings = (array) $settings; |
||
| 68 | |||
| 69 | foreach ($settings as $setting => $value) { |
||
| 70 | try{ |
||
| 71 | if ($setting === 'name') { |
||
| 72 | if (!is_dir('bots_files')) { |
||
| 73 | mkdir('bots_files'); |
||
| 74 | } |
||
| 75 | if (!is_dir('bots_files/'.$value)) { |
||
| 76 | mkdir('bots_files/'.$value); |
||
| 77 | } |
||
| 78 | $value = 'bots_files/'.$value.'/'; |
||
| 79 | } |
||
| 80 | self::$$setting = $value; |
||
| 81 | } |
||
| 82 | catch (TypeError){ |
||
| 83 | logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
||
| 84 | } |
||
| 85 | catch (Error){ |
||
| 86 | logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
||
| 87 | } |
||
| 88 | } |
||
| 89 | |||
| 90 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
||
| 91 | logger::init(isset($settings['log_size']) && is_numeric($settings['log_size']) ? $settings['log_size'] : self::$log_size); |
||
| 92 | } |
||
| 93 | |||
| 94 | if (self::$token !== '') { |
||
| 95 | if (tools::isToken(self::$token)) { |
||
| 96 | self::security(); |
||
| 97 | self::secureFolder(); |
||
| 98 | db::init(); |
||
| 99 | if (!empty(self::$receiver)) { |
||
| 100 | self::$receiver !== receiver::GETUPDATES ? webhook::init() : self::getUpdates(); |
||
| 101 | } |
||
| 102 | } |
||
| 103 | else { |
||
| 104 | logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
||
| 105 | throw new bptException('TOKEN_NOT_TRUE'); |
||
| 106 | } |
||
| 107 | } |
||
| 108 | else { |
||
| 109 | logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
||
| 110 | throw new bptException('TOKEN_NOT_FOUND'); |
||
| 111 | } |
||
| 169 |
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