1<?php
2/**
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     Brend Wanders <b.wanders@utwente.nl>
5 */
6// must be run within Dokuwiki
7if(!defined('DOKU_INC')) die('Meh.');
8
9/**
10 * This base class defines the methods required by Strata aggregates.
11 *
12 * Aggregates are a bit peculiar, as they transform a set of values into
13 * a set of values. This allows both normal aggregation (many->one), but
14 * also opens up the option of having (many->many) and (one->many)
15 * transformations.
16 */
17class plugin_strata_aggregate {
18    /**
19     * Aggregates the values and converts them to a new set of values.
20     *
21     * @param values array the set to aggregate
22     * @param hint string the aggregation hint
23     * @return an array containing the new values
24     */
25    function aggregate($values, $hint) {
26        return $values;
27    }
28
29    /**
30     * Returns meta-data on the aggregate. This method returns an array with
31     * the following keys:
32     *   - desc: A human-readable description of the aggregate
33     *   - synthetic: an optional boolean indicating that the aggregate is synthethic
34     *   - hint: an optional string indicating what the aggregate hint's function is
35     *   - tags: an array op applicable tags
36     *
37     * @return an array containing the info
38     */
39    function getInfo() {
40        return array(
41            'desc'=>'The generic aggregator. It does nothing.',
42            'hint'=>false,
43            'synthetic'=>true,
44            'tags'=>array()
45        );
46    }
47}
48