public function AllDocsNormalizer::normalize in Replication 8
Same name and namespace in other branches
- 8.2 src/Normalizer/AllDocsNormalizer.php \Drupal\replication\Normalizer\AllDocsNormalizer::normalize()
File
- src/
Normalizer/ AllDocsNormalizer.php, line 14
Class
Namespace
Drupal\replication\NormalizerCode
public function normalize($all_docs, $format = NULL, array $context = []) {
$data = [
'offset' => 0,
'rows' => [],
];
/** @var \Drupal\replication\AllDocs\AllDocsInterface $all_docs */
if (!empty($context['query']['include_docs'])) {
$all_docs
->includeDocs(TRUE);
}
$rows = $all_docs
->execute();
foreach ($rows as $key => $value) {
$data['rows'][] = [
'id' => $key,
'key' => $key,
'value' => $value,
];
}
$data['total_rows'] = count($rows);
return $data;
}