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