Skip to content

Commit

Permalink
Change structure of identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 15, 2023
1 parent 8d675d9 commit c94ba38
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions identifier-extractor/merge.php
Expand Up @@ -32,30 +32,19 @@
foreach ($data as $row) {
foreach ($row['identifiers'] as $identifier) {
if (!isset($dataByIdentifier[$identifier])) {
$dataByIdentifier[$identifier] = [
'classes' => [
$row['class'],
],
'repos' => [
$row['repo'],
],
'urls' => [
$row['url'],
],
];
continue;
$dataByIdentifier[$identifier] = [];
}
$class = $row['class'];
if (!isset($dataByIdentifier[$identifier][$class])) {
$dataByIdentifier[$identifier][$class] = [];
}

$dataByIdentifier[$identifier]['classes'][] = $row['class'];
$dataByIdentifier[$identifier]['repos'][] = $row['repo'];
$dataByIdentifier[$identifier]['urls'][] = $row['url'];
}
}
$repo = $row['repo'];
if (!isset($dataByIdentifier[$identifier][$class][$repo])) {
$dataByIdentifier[$identifier][$class][$repo] = [];
}

foreach ($dataByIdentifier as $identifier => $row) {
foreach ($row as $k => $v) {
sort($v);
$dataByIdentifier[$identifier][$k] = array_values(array_unique($v));
$dataByIdentifier[$identifier][$class][$repo][] = $row['url'];
}
}

Expand Down

0 comments on commit c94ba38

Please sign in to comment.