| Conditions | 11 |
| Paths | 67 |
| Total Lines | 42 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 97 | private function outputStorageDetails(IMountPoint $mountPoint, Node $node, OutputInterface $output): void { |
||
| 98 | $storage = $mountPoint->getStorage(); |
||
| 99 | if (!$storage) { |
||
| 100 | return; |
||
| 101 | } |
||
| 102 | if (!$storage->instanceOfStorage(IHomeStorage::class)) { |
||
| 103 | $output->writeln(" mounted at: " . $mountPoint->getMountPoint()); |
||
| 104 | } |
||
| 105 | if ($storage->instanceOfStorage(ObjectStoreStorage::class)) { |
||
| 106 | /** @var ObjectStoreStorage $storage */ |
||
| 107 | $objectStoreId = $storage->getObjectStore()->getStorageId(); |
||
| 108 | $parts = explode(':', $objectStoreId); |
||
| 109 | /** @var string $bucket */ |
||
| 110 | $bucket = array_pop($parts); |
||
| 111 | $output->writeln(" bucket: " . $bucket); |
||
| 112 | if ($node instanceof \OC\Files\Node\File) { |
||
| 113 | $output->writeln(" object id: " . $storage->getURN($node->getId())); |
||
| 114 | try { |
||
| 115 | $fh = $node->fopen('r'); |
||
| 116 | if (!$fh) { |
||
| 117 | throw new NotFoundException(); |
||
| 118 | } |
||
| 119 | $stat = fstat($fh); |
||
| 120 | fclose($fh); |
||
| 121 | if ($stat['size'] !== $node->getSize()) { |
||
| 122 | $output->writeln(" <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired"); |
||
| 123 | } |
||
| 124 | } catch (\Exception $e) { |
||
| 125 | $output->writeln(" <error>warning: object not found in bucket</error>"); |
||
| 126 | } |
||
| 127 | } |
||
| 128 | } else { |
||
| 129 | if (!$storage->file_exists($node->getInternalPath())) { |
||
| 130 | $output->writeln(" <error>warning: file not found in storage</error>"); |
||
| 131 | } |
||
| 132 | } |
||
| 133 | if ($mountPoint instanceof ExternalMountPoint) { |
||
| 134 | $storageConfig = $mountPoint->getStorageConfig(); |
||
| 135 | $output->writeln(" external storage id: " . $storageConfig->getId()); |
||
| 136 | $output->writeln(" external type: " . $storageConfig->getBackend()->getText()); |
||
| 137 | } elseif ($mountPoint instanceof GroupMountPoint) { |
||
| 138 | $output->writeln(" groupfolder id: " . $mountPoint->getFolderId()); |
||
| 139 | } |
||
| 142 |
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