| Conditions | 5 |
| Paths | 8 |
| Total Lines | 56 |
| Code Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 94 | private function updateFileMetaData($trackid, $editKey, $editValue) |
||
| 95 | { |
||
| 96 | $fileId = $this->DBController->getFileId($trackid); |
||
| 97 | if (!class_exists('getid3_exception')) { |
||
| 98 | require_once __DIR__ . '/../../3rdparty/getid3/getid3.php'; |
||
| 99 | } |
||
| 100 | require_once __DIR__ . '/../../3rdparty/getid3/write.php'; |
||
| 101 | |||
| 102 | $userView = new View('/' . $this->userId . '/files'); |
||
| 103 | $path = $userView->getPath($fileId); |
||
| 104 | $this->logger->debug('Section 2: ' . $fileId . ' Path : ' . $path, array('app' => 'audioplayer')); |
||
| 105 | |||
| 106 | if (\OC\Files\Filesystem::isUpdatable($path)) { |
||
| 107 | |||
| 108 | $tagWriter = new \getid3_writetags; |
||
| 109 | $localFile = $userView->getLocalFile($path); |
||
| 110 | $this->logger->debug('Updating following file: ' . $localFile, array('app' => 'audioplayer')); |
||
| 111 | $tagWriter->filename = $localFile; |
||
| 112 | $tagWriter->tagformats = array('id3v2.3'); |
||
| 113 | $tagWriter->overwrite_tags = false; |
||
| 114 | $tagWriter->tag_encoding = 'UTF-8'; |
||
| 115 | |||
| 116 | $resultData = [ |
||
| 117 | $editKey => [$editValue] |
||
| 118 | ]; |
||
| 119 | $resultData = $tagWriter->tag_data = $resultData; |
||
| 120 | $tagWriter->WriteTags(); |
||
| 121 | |||
| 122 | if (count($tagWriter->errors)) { |
||
| 123 | $this->logger->debug('errors: ' . print_r($tagWriter->errors), array('app' => 'audioplayer')); |
||
| 124 | $result = [ |
||
| 125 | 'status' => 'errors', |
||
| 126 | 'msg' => print_r($tagWriter->errors), |
||
| 127 | ]; |
||
| 128 | } elseif (count($tagWriter->warnings)) { |
||
| 129 | $this->logger->debug('errors: ' . print_r($tagWriter->warnings), array('app' => 'audioplayer')); |
||
| 130 | $result = [ |
||
| 131 | 'status' => 'warnings', |
||
| 132 | 'msg' => (string)$tagWriter->warnings, |
||
| 133 | ]; |
||
| 134 | } else { |
||
| 135 | $result = [ |
||
| 136 | 'status' => 'success', |
||
| 137 | 'data' => $resultData, |
||
| 138 | ]; |
||
| 139 | } |
||
| 140 | } else { |
||
| 141 | $result = [ |
||
| 142 | 'status' => 'error_write', |
||
| 143 | 'msg' => 'not writeable', |
||
| 144 | ]; |
||
| 145 | } |
||
| 146 | |||
| 147 | //$response = new JSONResponse(); |
||
| 148 | //$response -> setData($result); |
||
| 149 | return $result; |
||
| 150 | |||
| 153 |
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