| Conditions | 10 | 
| Paths | 3 | 
| Total Lines | 99 | 
| Code Lines | 64 | 
| 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 | ||
| 155 | public function retrieve($remoteId) | ||
| 156 |     { | ||
| 157 | $remoteXml = $this->remoteRepository->retrieve($remoteId); | ||
| 158 | |||
| 159 |         if ($remoteXml) { | ||
| 160 | |||
| 161 | $XSLTransformator = new XSLTransformator(); | ||
| 162 | $inputTransformedXML = $XSLTransformator->transformInputXML($remoteXml); | ||
| 163 | |||
| 164 | $internalFormat = new \EWW\Dpf\Helper\InternalFormat($inputTransformedXML); | ||
| 165 | |||
| 166 | $title = $internalFormat->getTitle(); | ||
| 167 | $authors = $internalFormat->getPersons(); | ||
| 168 | |||
| 169 | $documentTypeName = $internalFormat->getDocumentType(); | ||
| 170 | $documentType = $this->documentTypeRepository->findOneByName($documentTypeName); | ||
| 171 | |||
| 172 |             if (empty($title) || empty($documentType)) { | ||
| 173 | return false; | ||
| 174 | } | ||
| 175 | |||
| 176 | $state = $internalFormat->getRepositoryState(); | ||
| 177 | |||
| 178 | /* @var $document \EWW\Dpf\Domain\Model\Document */ | ||
| 179 | $document = $this->objectManager->get(Document::class); | ||
| 180 | |||
| 181 |             switch ($state) { | ||
| 182 | case "ACTIVE": | ||
| 183 | $document->setState(DocumentWorkflow::STATE_NONE_ACTIVE); | ||
| 184 | break; | ||
| 185 | case "INACTIVE": | ||
| 186 | $document->setState(DocumentWorkflow::STATE_NONE_INACTIVE); | ||
| 187 | break; | ||
| 188 | case "DELETED": | ||
| 189 | $document->setState(DocumentWorkflow::STATE_NONE_DELETED); | ||
| 190 | break; | ||
| 191 | default: | ||
| 192 |                     throw new \Exception("Unknown object state: " . $state); | ||
| 193 | break; | ||
| 194 | } | ||
| 195 | |||
| 196 | $document->setRemoteLastModDate($internalFormat->getRepositoryLastModDate()); | ||
| 197 | $document->setObjectIdentifier($remoteId); | ||
| 198 | $document->setTitle($title); | ||
| 199 | $document->setAuthors($authors); | ||
| 200 | $document->setDocumentType($documentType); | ||
| 201 | |||
| 202 | $document->setXmlData($inputTransformedXML); | ||
| 203 | |||
| 204 | $document->setDateIssued($internalFormat->getDateIssued()); | ||
| 205 | |||
| 206 | $document->setProcessNumber($internalFormat->getProcessNumber()); | ||
| 207 | |||
| 208 | $creationDate = $internalFormat->getCreationDate(); | ||
| 209 |             if (empty($creationDate)) { | ||
| 210 | $creationDate = $internalFormat->getRepositoryCreationDate(); | ||
| 211 | } | ||
| 212 | $document->setCreationDate($creationDate); | ||
| 213 | $document->setCreator($internalFormat->getCreator()); | ||
| 214 | |||
| 215 | $document->setTemporary(TRUE); | ||
| 216 | |||
| 217 | $this->documentRepository->add($document); | ||
| 218 | $this->persistenceManager->persistAll(); | ||
| 219 | |||
| 220 |             foreach ($internalFormat->getFiles() as $attachment) { | ||
| 221 | |||
| 222 | /** @var File $file */ | ||
| 223 | $file = $this->objectManager->get(File::class); | ||
| 224 | $file->setContentType($attachment['mimetype']); | ||
| 225 | $file->setDatastreamIdentifier($attachment['id']); | ||
| 226 | $file->setFileIdentifier($attachment['id']); | ||
| 227 | $file->setLink($attachment['href']); | ||
| 228 | $file->setTitle($attachment['title']); | ||
| 229 | $file->setLabel($attachment['title']); | ||
| 230 | $file->setDownload($attachment['download']); | ||
| 231 | $file->setArchive($attachment['archive']); | ||
| 232 | $file->setFileGroupDeleted($attachment['deleted']); | ||
| 233 | |||
| 234 |                 if ($attachment['id'] == \EWW\Dpf\Domain\Model\File::PRIMARY_DATASTREAM_IDENTIFIER) { | ||
| 235 | $file->setPrimaryFile(true); | ||
| 236 | } | ||
| 237 | |||
| 238 | $file->setDocument($document); | ||
| 239 | |||
| 240 | $this->fileRepository->add($file); | ||
| 241 | $document->addFile($file); | ||
| 242 | } | ||
| 243 | |||
| 244 | $this->documentRepository->update($document); | ||
| 245 | $this->persistenceManager->persistAll(); | ||
| 246 | |||
| 247 | return $document; | ||
| 248 | |||
| 249 |         } else { | ||
| 250 | return NULL; | ||
| 251 | } | ||
| 252 | |||
| 253 | return NULL; | ||
| 254 | } | ||
| 312 | 
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