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