Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core update to searchobjects en countobjects, requires CoreBundle:1.4.13 #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"minimum-stability": "dev",
"require": {
"php": ">=8.0",
"commongateway/corebundle": ">=1.3.11",
"commongateway/corebundle": "^1.4.13 | <2.0",
"league/flysystem-ziparchive": "^2.3.1"
},
"require-dev": {
Expand Down
12 changes: 6 additions & 6 deletions publiccode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ localisation:
dependsOn:
open:
- name: CommonGateway
versionMin: 1.2
versionMax: 1.3
version: 1.2.47
versionMin: 1.4
versionMax: 1.5
version: 1.4.13
optional: false
- name: CoreBundle
versionMin: 1.2
versionMax: 1.3
version: 1.2.47
versionMin: 1.4
versionMax: 1.5
version: 1.4.13
optional: false
roadmap: null
inputTypes:
Expand Down
7 changes: 2 additions & 5 deletions src/Service/BrkService.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use Twig\Error\LoaderError;
use Twig\Error\SyntaxError;

class BrkService

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has 1038 lines of code. Current threshold is 1000. Avoid really long classes.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has 15 public methods. Consider refactoring BrkService to keep number of public methods under 10.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has an overall complexity of 100 which is very high. The configured complexity threshold is 50.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has 1038 lines of code. Current threshold is 1000. Avoid really long classes.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has 15 public methods. Consider refactoring BrkService to keep number of public methods under 10.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has an overall complexity of 100 which is very high. The configured complexity threshold is 50.

Check warning on line 36 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The class BrkService has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
{

/**
Expand Down Expand Up @@ -138,7 +138,7 @@
*
* @throws Exception
*/
public function getFromCache(string $id): ?ObjectEntity

Check warning on line 141 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid variables with short names like $id. Configured minimum length is 3.

Check warning on line 141 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid variables with short names like $id. Configured minimum length is 3.
{
$item = $this->cache->getItem($id);
if ($item->isHit() === true) {
Expand All @@ -160,13 +160,13 @@
*
* @return string The value of the key-value pair.
*/
public function addToCache(string $id, string $value): string

Check warning on line 163 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid variables with short names like $id. Configured minimum length is 3.

Check warning on line 163 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid variables with short names like $id. Configured minimum length is 3.
{

$item = $this->cache->getItem($id);

$item->set($value);
$item->expiresAt(new \DateTime('+10 days'));

Check warning on line 169 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Missing class import via use statement (line '169', column '30').

Check warning on line 169 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Missing class import via use statement (line '169', column '30').
$this->cache->save($item);

return $item->get();
Expand Down Expand Up @@ -209,7 +209,7 @@
&& $this->isAssociative($objectArray['embedded'][$attribute->getName()])
) {
$subObject = $objects[0];
$subObject->setId(Uuid::fromString($objectArray['embedded'][$attribute->getName()]['_self']['id']));

Check warning on line 212 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid using static access to class '\Ramsey\Uuid\Uuid' in method 'reconnectIds'.

Check warning on line 212 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid using static access to class '\Ramsey\Uuid\Uuid' in method 'reconnectIds'.
$this->entityManager->persist($subObject);
$this->entityManager->persist($subObject);
continue;
Expand All @@ -217,7 +217,7 @@

if(isset($objectArray['embedded'][$attribute->getName()]) === true) {
foreach($objects as $key => $subObject) {
$subObject->setId(Uuid::fromString($objectArray['embedded'][$attribute->getName()][$key]['_self']['id']));

Check warning on line 220 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid using static access to class '\Ramsey\Uuid\Uuid' in method 'reconnectIds'.

Check warning on line 220 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 130 characters

Check warning on line 220 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Avoid using static access to class '\Ramsey\Uuid\Uuid' in method 'reconnectIds'.

Check warning on line 220 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 130 characters
$this->entityManager->persist($subObject);
$this->entityManager->persist($subObject);
}
Expand Down Expand Up @@ -302,7 +302,7 @@
*
* @return array The array of parents with children connected.
*/
public function connectInversed(array $parents, array $children, string $property, bool $singular=true): array

Check warning on line 305 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The method connectInversed has a boolean flag argument $singular, which is a certain sign of a Single Responsibility Principle violation.

Check warning on line 305 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

The method connectInversed has a boolean flag argument $singular, which is a certain sign of a Single Responsibility Principle violation.
{
foreach ($parents as $key => $parent) {
if (isset($parent['identificatie']) === true) {
Expand Down Expand Up @@ -495,12 +495,11 @@
if (isset($snapshot['Appartementsrecht']['hoofdsplitsing']['HoofdsplitsingRef']['#']) === true) {
$splitsingId = $snapshot['Appartementsrecht']['hoofdsplitsing']['HoofdsplitsingRef']['#'];

// $snapshot['Appartementsrecht']['hoofdsplitsing']['HoofdsplitsingRef']['#'] = $this->getFromCache($splitsingId);

Check warning on line 498 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 130 characters

Check warning on line 498 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 130 characters
$snapshot['Appartementsrecht']['hoofdsplitsing']['HoofdsplitsingRef']['#'] = null;

if ($snapshot['Appartementsrecht']['hoofdsplitsing']['HoofdsplitsingRef']['#'] === null) {
$percelen = $this->cacheService->searchObjects(
null,
['embedded.zakelijkGerechtigdeIdentificaties.hoofdsplitsing' => $splitsingId],
[$ozSchema->getId()->toString()]
)['results'];
Expand All @@ -514,7 +513,7 @@
$this->entityManager->persist($perceelObject);
$perceelObject->hydrate(\Safe\json_decode(\Safe\json_encode($perceel), true));

$perceelObject = $this->reconnectIds($perceelObject, \Safe\json_decode(\Safe\json_encode($perceel), true));

Check warning on line 516 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 139 characters

Check warning on line 516 in src/Service/BrkService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 139 characters
$this->entityManager->persist($perceelObject);
$this->cacheService->cacheObject($perceelObject);

Expand Down Expand Up @@ -609,7 +608,7 @@
}

$vveId = $hoofdsplitsing['heeftVerenigingVanEigenaren']['NietNatuurlijkPersoonRef']['#'];
$vves = $this->cacheService->searchObjects(null, ['identificatie' => $vveId], [$nnpSchema->getId()->toString()])['results'];
$vves = $this->cacheService->searchObjects(['identificatie' => $vveId], [$nnpSchema->getId()->toString()])['results'];

if (count($vves) === 0) {
return;
Expand All @@ -618,7 +617,6 @@
$vve = $vves[0]['_self']['id'];

$results = $this->cacheService->searchObjects(
null,
['embedded.zakelijkGerechtigdeIdentificaties.hoofdsplitsing' => $splitsingId],
[$ozSchema->getId()->toString()]
)['results'];
Expand Down Expand Up @@ -859,7 +857,6 @@

foreach ($fileDataSet['stand']['KadastraalObjectSnapshot'] as $object) {
$snapshots = $this->cacheService->searchObjects(
null,
['referentie' => $object['referentie']],
[$this->configuration['schema']->getId()->toString()]
)['results'];
Expand Down Expand Up @@ -1035,7 +1032,7 @@
];
}

$oldArray = $this->cacheService->searchObjects(null, ['identificatie' => $refObject['identificatie']], [$schema->getId()->toString()])['results'];
$oldArray = $this->cacheService->searchObjects(['identificatie' => $refObject['identificatie']], [$schema->getId()->toString()])['results'];

// $synchronization = $this->syncService->findSyncBySource(
// $this->configuration['source'],
Expand Down
1 change: 0 additions & 1 deletion src/Service/GdsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* This service connects to the GDS download service of the kadaster in order to retrieve new data.
*
* @package common-gateway/brk-bundle

Check failure on line 7 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Package name "common-gateway/brk-bundle" is not valid; consider "Commongatewaybrkbundle" instead

Check failure on line 7 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Package name "common-gateway/brk-bundle" is not valid; consider "Commongatewaybrkbundle" instead
*
* @author Robert Zondervan <[email protected]>
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
Expand Down Expand Up @@ -165,7 +165,7 @@
private function getDataUrls(array $result): array
{
$locations = [];
$baseUrls = $result['SOAP-ENV:Body']['ns9:BestandenlijstOpvragenResponse']['ns9:antwoord']['ns3:BaseURLSet']['ns4:BaseURL'];

Check warning on line 168 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 133 characters

Check warning on line 168 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 133 characters

foreach ($baseUrls as $baseUrl) {
if ($baseUrl['@type'] === 'certificaat') {
Expand All @@ -173,11 +173,11 @@
}
}

$files = $result['SOAP-ENV:Body']['ns9:BestandenlijstOpvragenResponse']['ns9:antwoord']['ns5:BestandenLijst']['ns5:Afgifte'];

Check warning on line 176 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 133 characters

Check warning on line 176 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 133 characters

if ($this->brkService->isAssociative($files) === true) {
$fileUrl = $files['ns8:digikoppeling-external-datareferences']['ns8:data-reference']['ns8:transport']['ns8:location']['ns8:senderUrl']['#'];

Check failure on line 179 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds maximum limit of 150 characters; contains 156 characters

Check failure on line 179 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds maximum limit of 150 characters; contains 156 characters
$mime = $files['ns8:digikoppeling-external-datareferences']['ns8:data-reference']['ns8:content']['@contentType'];

Check warning on line 180 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 132 characters

Check warning on line 180 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 132 characters
$locations[] = [
'url' => "{$baseUrl['#']}/$fileUrl",
'mime' => "$mime",
Expand All @@ -188,7 +188,7 @@

foreach ($files as $file) {
$fileUrl = $file['ns8:digikoppeling-external-datareferences']['ns8:data-reference']['ns8:transport']['ns8:location']['ns8:senderUrl']['#'];
$mime = $file['ns8:digikoppeling-external-datareferences']['ns8:data-reference']['ns8:content']['@contentType'];

Check warning on line 191 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 131 characters

Check warning on line 191 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 131 characters
$locations[] = [
'url' => "{$baseUrl['#']}/$fileUrl",
'mime' => "$mime",
Expand Down Expand Up @@ -271,7 +271,7 @@
$snapshotsToMap = [];
$createdSnapshots = [];

$this->removeDeletedObjects(was: $data['wordt']['KadastraalObjectSnapshot'], becomes: $data['was']['KadastraalObjectSnapshot']);

Check warning on line 274 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 136 characters

Check warning on line 274 in src/Service/GdsService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 136 characters

$snapshotsToMap[] = $data['wordt']['KadastraalObjectSnapshot'];

Expand All @@ -284,7 +284,6 @@

foreach ($snapshotsToMap as $snapshot) {
$snapshots = $this->cacheService->searchObjects(
null,
['referentie' => $snapshot['referentie']],
[$snapshotSchema->getId()->toString()]
)['results'];
Expand Down
Loading