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