| Conditions | 13 |
| Paths | 170 |
| Total Lines | 71 |
| Code Lines | 43 |
| 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 |
||
| 40 | public function run($request) |
||
| 41 | { |
||
| 42 | $this->addLogHandlers(); |
||
| 43 | |||
| 44 | $args = $request->getVars(); |
||
| 45 | $this->validateArgs($args); |
||
| 46 | |||
| 47 | $subtasks = !empty($args['only']) ? explode(',', $args['only']) : $this->defaultSubtasks; |
||
| 48 | |||
| 49 | if (in_array('move-files', $subtasks)) { |
||
| 50 | if (!class_exists(FileMigrationHelper::class)) { |
||
| 51 | $this->logger->error("No file migration helper detected"); |
||
| 52 | return; |
||
| 53 | } |
||
| 54 | |||
| 55 | $this->logger->info('### Migrating filesystem and database records (move-files)'); |
||
| 56 | |||
| 57 | $this->logger->info('If the task fails or times out, run it again and it will start where it left off.'); |
||
| 58 | |||
| 59 | $migrated = FileMigrationHelper::singleton()->run(); |
||
| 60 | if ($migrated) { |
||
| 61 | $this->logger->info("{$migrated} File DataObjects upgraded"); |
||
| 62 | } else { |
||
| 63 | $this->logger->info("No File DataObjects need upgrading"); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | |||
| 67 | if (in_array('move-thumbnails', $subtasks)) { |
||
| 68 | if (!class_exists(LegacyThumbnailMigrationHelper::class)) { |
||
| 69 | $this->logger->error("LegacyThumbnailMigrationHelper not found"); |
||
| 70 | return; |
||
| 71 | } |
||
| 72 | |||
| 73 | $this->logger->info('### Migrating existing thumbnails (move-thumbnails)'); |
||
| 74 | |||
| 75 | $moved = LegacyThumbnailMigrationHelper::singleton() |
||
| 76 | ->setLogger($this->logger) |
||
| 77 | ->run($this->getStore()); |
||
| 78 | |||
| 79 | if ($moved) { |
||
| 80 | $this->logger->info(sprintf("%d thumbnails moved", count($moved))); |
||
| 81 | } else { |
||
| 82 | $this->logger->info("No thumbnails moved"); |
||
| 83 | } |
||
| 84 | } |
||
| 85 | |||
| 86 | if (in_array('generate-cms-thumbnails', $subtasks)) { |
||
| 87 | if (!class_exists(ImageThumbnailHelper::class)) { |
||
| 88 | $this->logger->error("ImageThumbnailHelper not found"); |
||
| 89 | return; |
||
| 90 | } |
||
| 91 | |||
| 92 | $this->logger->info('### Generating new CMS UI thumbnails (generate-cms-thumbnails)'); |
||
| 93 | |||
| 94 | ImageThumbnailHelper::singleton()->run(); |
||
| 95 | } |
||
| 96 | |||
| 97 | if (in_array('fix-folder-permissions', $subtasks)) { |
||
| 98 | if (!class_exists(FixFolderPermissionsHelper::class)) { |
||
| 99 | $this->logger->error("FixFolderPermissionsHelper not found"); |
||
| 100 | return; |
||
| 101 | } |
||
| 102 | |||
| 103 | $this->logger->info('### Fixing folder permissions (fix-folder-permissions)'); |
||
| 104 | |||
| 105 | $updated = FixFolderPermissionsHelper::singleton()->run(); |
||
| 106 | |||
| 107 | if ($updated > 0) { |
||
| 108 | $this->logger->info("Repaired {$updated} folders with broken CanViewType settings"); |
||
| 109 | } else { |
||
| 110 | $this->logger->info("No folders required fixes"); |
||
| 111 | } |
||
| 176 |
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