diff --git a/src/Service/GithubApiService.php b/src/Service/GithubApiService.php index 6c4eafe9..0d8a8913 100644 --- a/src/Service/GithubApiService.php +++ b/src/Service/GithubApiService.php @@ -216,7 +216,6 @@ public function getGithubRepository(string $repositoryUrl, ?array $repositoryArr $repository = $repositorySync->getObject(); - // Get the publiccode/opencatalogi files of the given repository. $path = trim(\Safe\parse_url($repositoryUrl)['path'], '/'); // Call the search/code endpoint for publiccode files in this repository. @@ -252,7 +251,8 @@ public function cleanupRepository(ObjectEntity $repository): ?ObjectEntity { // If the repository has one or less components return. if ($repository->getValue('components') === false - || $repository->getValue('components')->count() <= 1) { + || $repository->getValue('components')->count() <= 1 + ) { return $repository; } @@ -375,7 +375,7 @@ public function enrichRepository(ObjectEntity $repository, array $repositoryArra /** * This function loops through the array with publiccode/opencatalogi files. * - * @param array $item An array with opencatalogi file. + * @param array $item An array with opencatalogi file. * * @return array|null An array with the opencatalogi => imported opencatalogi file /sourceId => The sourceId /sha => The sha (used as sourceId) * @throws Exception @@ -422,8 +422,8 @@ public function importOpenCatalogiFile(array $item): ?array /** * This function loops through the array with publiccode/opencatalogi files. * - * @param array $dataArray An array with publiccode/opencatalogi files. - * @param Source $source The github api source. + * @param array $dataArray An array with publiccode/opencatalogi files. + * @param Source $source The github api source. * * @return array|null An array with the publiccode => imported publiccode file /sourceId => The sourceId /sha => The sha * @throws Exception @@ -447,15 +447,15 @@ public function importPubliccodeFile(array $item): ?array // Check if the publiccodeYmlVersion is set otherwise this is not a valid file. $publiccode = $this->getFileFromRawUserContent($publiccodeUrl, $item['git_url']); if ($publiccode === null) { - return null; } return [ 'publiccode' => $publiccode, - 'sourceId' => $sourceId, - 'sha' => $urlReference, + 'sourceId' => $sourceId, + 'sha' => $urlReference, ]; + }//end importPubliccodeFile() diff --git a/src/Service/OpenCatalogiService.php b/src/Service/OpenCatalogiService.php index f94b79cf..c4eac3ab 100644 --- a/src/Service/OpenCatalogiService.php +++ b/src/Service/OpenCatalogiService.php @@ -115,6 +115,7 @@ public function setConfiguration(array $configuration): void }//end setConfiguration() + /** * This function enriches the opencatalogi file organization. * @@ -174,7 +175,6 @@ public function enrichOpencatalogiOrg(array $organizationArray, array $opencatal }//end enrichOpencatalogiOrg() - /** * This function loops through the array with publiccode/opencatalogi files. * diff --git a/src/Service/PubliccodeService.php b/src/Service/PubliccodeService.php index 5931b02c..7e5266d6 100644 --- a/src/Service/PubliccodeService.php +++ b/src/Service/PubliccodeService.php @@ -762,8 +762,8 @@ public function handlePubliccodeFile(array $publiccodeArray, Source $source, Obj } $publiccode = $data['publiccode']; - $sourceId = $data['sourceId']; - $sha = $data['sha']; + $sourceId = $data['sourceId']; + $sha = $data['sha']; $this->pluginLogger->info('Map the publiccode file with path: '.$publiccodeArray['path'].' and source id: '.$sourceId); @@ -788,21 +788,20 @@ public function handlePubliccodeFile(array $publiccodeArray, Source $source, Obj $componentSync = $this->syncService->findSyncBySource($source, $componentSchema, $sourceId); // Check the sha of the sync with the sha in the array. - if ($this->syncService->doesShaMatch($componentSync, $sha) === true) { - $componentSync->getObject()->hydrate(['url' => $repository]); + if ($this->syncService->doesShaMatch($componentSync, $sha) === true) { + $componentSync->getObject()->hydrate(['url' => $repository]); - $this->entityManager->persist($componentSync->getObject()); - $this->entityManager->flush(); + $this->entityManager->persist($componentSync->getObject()); + $this->entityManager->flush(); - $this->pluginLogger->info('The sha is the same as the sha from the component sync. The given sha (publiccode url from the github api) is: '.$urlReference); + $this->pluginLogger->info('The sha is the same as the sha from the component sync. The given sha (publiccode url from the github api) is: '.$urlReference); - return $repository; - } + return $repository; + } // Map the publiccode file. $componentArray = $dataArray = $this->mappingService->mapping($publiccodeMapping, $publiccode); - // Check if the logo property is set and is not null. if (key_exists('logo', $componentArray) === true && $componentArray['logo'] !== null