1<?php
2
3namespace TableRoller\Table;
4
5class DokuwikiJsonTable extends BaseTable
6{
7   public function __construct(string $json)
8   {
9		$rows = json_decode($json);
10		// transform our json into what the table roller class expects
11		// this is a bit of a round-trip but it helps make the options
12		// what the class exects
13		$options = array_map(function($item) {
14			return sprintf('%d-%d: %s', $item->min, $item->max, $item->result);
15		}, $rows);
16
17        $this->setOptions($options);
18   }
19}