Skip to content

Commit

Permalink
merge.php - output identifier stats into stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 9, 2024
1 parent fd53b6e commit 7069037
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions identifier-extractor/merge.php
Expand Up @@ -9,6 +9,7 @@
$tmpResults = [];

$data = [];
$classes = [];
foreach ($finder->files()->name('*.json')->in(__DIR__ . '/tmp') as $resultFile) {
$contents = file_get_contents($resultFile->getPathname());
if ($contents === false) {
Expand All @@ -19,6 +20,7 @@
$branch = $json['branch'];

foreach ($json['data'] as $row) {
$classes[$row['class']] = true;
$data[] = [
'identifiers' => $row['identifiers'],
'class' => $row['class'],
Expand Down Expand Up @@ -65,4 +67,9 @@
}
}

$identifierCount = count($dataByIdentifier);
$classesCount = count($classes);

fwrite(STDERR, sprintf("Total: %d identifiers in %d rules\n", $identifierCount, $classesCount));

echo Json::encode($dataByIdentifier, true);

0 comments on commit 7069037

Please sign in to comment.