--
$page;
/** @var array<string, array{iso: string, id: string}> $metaData */
$metaData =
$this->
getSetMetaData($context);
$isoList =
$this->
createIsoList($metaData);
$languageFiles =
$this->
getSnippetFilesByIso($isoList);
$fileSnippets =
$this->
getFileSnippets($languageFiles,
$isoList);
$dbSnippets =
$this->
databaseSnippetsToArray($this->
findSnippetInDatabase(new Criteria(),
$context),
$fileSnippets);
$snippets =
array_replace_recursive($fileSnippets,
$dbSnippets);
$snippets =
$this->
fillBlankSnippets($snippets,
$isoList);
foreach ($requestFilters as $requestFilterName =>
$requestFilterValue) { $snippets =
$this->snippetFilterFactory->
getFilter($requestFilterName)->
filter($snippets,
$requestFilterValue);
} $snippets =
$this->
sortSnippets($sort,
$snippets);
$total = 0;
foreach ($snippets as &
$set) { $total =
$total > 0 ?
$total : \
count($set['snippets'
]);
$set['snippets'
] =
array_chunk($set['snippets'
],
$limit, true
)[$page] ??
[];
}