| Conditions | 18 | 
| Paths | 107 | 
| Total Lines | 78 | 
| Code Lines | 55 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 1 | 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  | 
            ||
| 63 | protected function runForFolder($parentID)  | 
            ||
| 64 |     { | 
            ||
| 65 |         if ($this->oneFolderOnlyID && $this->oneFolderOnlyID !== $parentID) { | 
            ||
| 66 | return;  | 
            ||
| 67 | }  | 
            ||
| 68 |         if ($parentID) { | 
            ||
| 69 | $folder = Folder::get_by_id($parentID);  | 
            ||
| 70 |             FlushNowImplementor::do_flush('<h3>Processing Folder: ' . $folder->getFilename() . '</h3>'); | 
            ||
| 71 |         } else { | 
            ||
| 72 |             FlushNowImplementor::do_flush('<h3>Processing Root Folder</h3>'); | 
            ||
| 73 | }  | 
            ||
| 74 | $sqlQuery = new SQLSelect();  | 
            ||
| 75 |         $sqlQuery->setFrom('File'); | 
            ||
| 76 |         $sqlQuery->selectField('ID'); | 
            ||
| 77 | $sqlQuery->addWhere(['ParentID' => $parentID]);  | 
            ||
| 78 |         $sqlQuery->setOrderBy('Name'); | 
            ||
| 79 | |||
| 80 | // Execute and return a Query object  | 
            ||
| 81 | $result = $sqlQuery->execute();  | 
            ||
| 82 |         foreach ($result as $row) { | 
            ||
| 83 | $file = File::get_by_id($row['ID']);  | 
            ||
| 84 |             if (null !== $file) { | 
            ||
| 85 | $name = $file->getFilename();  | 
            ||
| 86 |                 if (!$name) { | 
            ||
| 87 | $file->write();  | 
            ||
| 88 | $name = $file->getFilename();  | 
            ||
| 89 | }  | 
            ||
| 90 |                 if ($this->oneFileOnlyID && $this->oneFileOnlyID !== $file->ID) { | 
            ||
| 91 | continue;  | 
            ||
| 92 | }  | 
            ||
| 93 |                 if ($name) { | 
            ||
| 94 |                     if ($this->updateLocation) { | 
            ||
| 95 | $this->updateLocationForOneFile($file, $name);  | 
            ||
| 96 | $file = File::get_by_id($row['ID']);  | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 |                     try { | 
            ||
| 100 |                         if ($file->exists()) { | 
            ||
| 101 | |||
| 102 | $this->publishFile($file, $name);  | 
            ||
| 103 |                         } else { | 
            ||
| 104 |                             FlushNowImplementor::do_flush('... Error in publishing V2 ...' . print_r($file->toMap(), 1), 'deleted'); | 
            ||
| 105 | }  | 
            ||
| 106 |                     } catch (\Exception $exception) { | 
            ||
| 107 |                         FlushNowImplementor::do_flush('... Error in publishing V1 ...' . print_r($file->toMap(), 1), 'deleted'); | 
            ||
| 108 | }  | 
            ||
| 109 |                 } else { | 
            ||
| 110 | $fix = false;  | 
            ||
| 111 |                     foreach ([''] as $suffix) { | 
            ||
| 112 |                         $fileNameOld = DB::query('SELECT "Filename" FROM "File' . $suffix . '" WHERE ID = ' . $file->ID)->value(); | 
            ||
| 113 |                         $fileNameNewTest = DB::query('SELECT "FileFilename" FROM "File' . $suffix . '" WHERE ID = ' . $file->ID)->value(); | 
            ||
| 114 |                         if ($fileNameOld && !$fileNameNewTest) { | 
            ||
| 115 | $newFileName = str_replace(  | 
            ||
| 116 | 'assets/',  | 
            ||
| 117 | '',  | 
            ||
| 118 | $fileNameOld  | 
            ||
| 119 | );  | 
            ||
| 120 | DB::query(  | 
            ||
| 121 | 'UPDATE "File' . $suffix . '" SET "FileFilename" = \'' . $newFileName . '\' WHERE "ID" = \'' . $file->ID . '\' LIMIT 1;'  | 
            ||
| 122 | );  | 
            ||
| 123 | $fix = true;  | 
            ||
| 124 | }  | 
            ||
| 125 | }  | 
            ||
| 126 |                     if ($fix) { | 
            ||
| 127 | FlushNowImplementor::do_flush(  | 
            ||
| 128 | '... Fixed file name for ' . $file->ID . ' - run this task again to complete.',  | 
            ||
| 129 | 'created'  | 
            ||
| 130 | );  | 
            ||
| 131 |                     } else { | 
            ||
| 132 |                         FlushNowImplementor::do_flush('... Error in finding name for ' . print_r($file->toMap(), 1), 'deleted'); | 
            ||
| 133 | }  | 
            ||
| 134 | }  | 
            ||
| 135 | |||
| 136 | $file->destroy();  | 
            ||
| 137 | }  | 
            ||
| 138 | |||
| 139 |             if ($file instanceof Folder) { | 
            ||
| 140 | $this->runForFolder($file->ID);  | 
            ||
| 141 | }  | 
            ||
| 221 | 
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