Skip to content

Commit

Permalink
Update src from PHP Codesniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Jan 15, 2024
1 parent ebb2a28 commit 86e0e02
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
16 changes: 8 additions & 8 deletions src/Service/GithubApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion src/Service/OpenCatalogiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function setConfiguration(array $configuration): void

}//end setConfiguration()


/**
* This function enriches the opencatalogi file organization.
*
Expand Down Expand Up @@ -174,7 +175,6 @@ public function enrichOpencatalogiOrg(array $organizationArray, array $opencatal
}//end enrichOpencatalogiOrg()



/**
* This function loops through the array with publiccode/opencatalogi files.
*
Expand Down
19 changes: 9 additions & 10 deletions src/Service/PubliccodeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down

0 comments on commit 86e0e02

Please sign in to comment.