xref: /plugin/dw2pdf/src/BookCreatorLiveSelectionCollector.php (revision 5340eaffbcc1177667ac835e4e719d9eb8959315)
1<?php
2
3namespace dokuwiki\plugin\dw2pdf\src;
4
5class BookCreatorLiveSelectionCollector extends AbstractCollector
6{
7    /**
8     * @inheritdoc
9     * @throws \JsonException
10     */
11    protected function collect(): array
12    {
13        $selection = $this->getConfig()->getLiveSelection();
14        if ($selection === null) return [];
15        $list = (array)json_decode($selection, true, 512, JSON_THROW_ON_ERROR);
16        return array_filter($list, fn($page) => page_exists($page));
17    }
18}
19