xref: /plugin/struct/_test/mock/AccessTable.php (revision 94c9aa4c35772fbb179d28f4aef658deddfcccb4)
1<?php
2
3namespace dokuwiki\plugin\struct\test\mock;
4
5use dokuwiki\plugin\struct\meta\Schema;
6use dokuwiki\plugin\struct\meta;
7
8abstract class AccessTable extends meta\AccessTable {
9
10    /**
11     * @param Schema $schema
12     * @param int|string $pid
13     * @return meta\AccessTableLookup|AccessTableData
14     */
15    public static function bySchema(Schema $schema, $pid) {
16        if($schema->isLookup()) {
17            return new meta\AccessTableLookup($schema, $pid); // FIXME not mocked, yet
18        } else {
19            return new AccessTableData($schema, $pid);
20        }
21    }
22
23    public static function byTableName($tablename, $pid, $ts = 0) {
24        $schema = new Schema($tablename, $ts);
25        return self::bySchema($schema, $pid); // becuse we have a static call here we can not rely on inheritance
26    }
27
28}
29