Conditions | 12 |
Paths | 20 |
Total Lines | 36 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
51 | public static function init (array|stdClass $settings) { |
||
52 | $settings = (array) $settings; |
||
53 | |||
54 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
||
55 | logger::init(isset($settings['log_size']) && is_numeric($settings['log_size']) ? $settings['log_size'] : self::$log_size); |
||
56 | } |
||
57 | |||
58 | foreach ($settings as $setting => $value) { |
||
59 | try{ |
||
60 | self::$$setting = $value; |
||
61 | } |
||
62 | catch (TypeError){ |
||
63 | logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
||
64 | } |
||
65 | catch (Error){ |
||
66 | logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
||
67 | } |
||
68 | } |
||
69 | |||
70 | if (self::$token !== '') { |
||
71 | if (tools::isToken(self::$token)) { |
||
72 | self::security(); |
||
73 | self::secureFolder(); |
||
74 | self::db(); |
||
75 | if (!empty(self::$receiver)) { |
||
76 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
||
77 | } |
||
78 | } |
||
79 | else { |
||
80 | logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
||
81 | throw new bptException('TOKEN_NOT_TRUE'); |
||
82 | } |
||
83 | } |
||
84 | else { |
||
85 | logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
||
86 | throw new bptException('TOKEN_NOT_FOUND'); |
||
87 | } |
||
152 |
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