| Conditions | 9 |
| Paths | 10 |
| Total Lines | 80 |
| Code Lines | 61 |
| 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 |
||
| 75 | public function update ($component_name = null, $mode = self::MODE_ADD) { |
||
| 76 | time_limit_pause(); |
||
| 77 | $storage = STORAGE.'/Composer'; |
||
| 78 | $status_code = 0; |
||
| 79 | $description = ''; |
||
| 80 | $this->prepare($storage); |
||
| 81 | $composer_json = $this->generate_composer_json($component_name, $mode); |
||
| 82 | $Config = Config::instance(); |
||
| 83 | $auth_json = _json_decode($Config->module('Composer')->auth_json ?: '[]'); |
||
| 84 | $Event = Event::instance(); |
||
| 85 | $Event->fire( |
||
| 86 | 'Composer/generate_composer_json', |
||
| 87 | [ |
||
| 88 | 'composer_json' => &$composer_json, |
||
| 89 | 'auth_json' => &$auth_json |
||
| 90 | ] |
||
| 91 | ); |
||
| 92 | if ($composer_json['repositories']) { |
||
| 93 | $this->file_put_json("$storage/tmp/composer.json", $composer_json); |
||
| 94 | $this->file_put_json("$storage/tmp/auth.json", $auth_json); |
||
| 95 | if ( |
||
| 96 | $this->force_update || |
||
| 97 | !file_exists("$storage/composer.json") || |
||
| 98 | md5_file("$storage/tmp/composer.json") != md5_file("$storage/composer.json") |
||
| 99 | ) { |
||
| 100 | $this->force_update = false; |
||
| 101 | $Application = new Application( |
||
| 102 | function ($Composer) use ($Event, &$Application) { |
||
| 103 | $Event->fire( |
||
| 104 | 'Composer/Composer', |
||
| 105 | [ |
||
| 106 | 'Application' => $Application, |
||
| 107 | 'Composer' => $Composer |
||
| 108 | ] |
||
| 109 | ); |
||
| 110 | } |
||
| 111 | ); |
||
| 112 | $verbosity = !DEBUG && $Config->core['simple_admin_mode'] ? '-vv' : '-vvv'; |
||
| 113 | $input = new ArrayInput( |
||
| 114 | [ |
||
| 115 | 'command' => 'update', |
||
| 116 | '--working-dir' => "$storage/tmp", |
||
| 117 | '--no-dev' => true, |
||
| 118 | '--ansi' => true, |
||
| 119 | '--prefer-dist' => true, |
||
| 120 | '--optimize-autoloader' => true, |
||
| 121 | $verbosity => true |
||
| 122 | ] |
||
| 123 | ); |
||
| 124 | $output = new Output; |
||
| 125 | $Application->setAutoExit(false); |
||
| 126 | $status_code = $Application->run($input, $output); |
||
| 127 | $description = $output->get_buffer(); |
||
| 128 | if ($status_code == 0) { |
||
| 129 | rmdir_recursive("$storage/vendor"); |
||
| 130 | @unlink("$storage/composer.json"); |
||
| 131 | @unlink("$storage/composer.lock"); |
||
| 132 | rename("$storage/tmp/vendor", "$storage/vendor"); |
||
| 133 | rename("$storage/tmp/composer.json", "$storage/composer.json"); |
||
| 134 | rename("$storage/tmp/composer.lock", "$storage/composer.lock"); |
||
| 135 | $Event->fire( |
||
| 136 | 'Composer/updated', |
||
| 137 | [ |
||
| 138 | 'composer_json' => file_get_json("$storage/composer.json"), |
||
| 139 | 'composer_lock' => file_get_json("$storage/composer.lock"), |
||
| 140 | 'composer_root' => $storage |
||
| 141 | ] |
||
| 142 | ); |
||
| 143 | } |
||
| 144 | } |
||
| 145 | } else { |
||
| 146 | rmdir_recursive("$storage/vendor"); |
||
| 147 | @unlink("$storage/composer.json"); |
||
| 148 | @unlink("$storage/composer.lock"); |
||
| 149 | } |
||
| 150 | $this->cleanup($storage); |
||
| 151 | time_limit_pause(false); |
||
| 152 | return [ |
||
| 153 | 'code' => $status_code, |
||
| 154 | 'description' => $description |
||
| 155 | ]; |
||
| 266 |
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