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