xref: /plugin/struct/_test/mock/AccessTable.php (revision 00bff81c57638c56aa4e85d91c0f80d92dd8338f)
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     * @param int $rid
15     * @return meta\AccessTableLookup|AccessTableData
16     */
17    public static function bySchema(Schema $schema, $pid, $ts = 0, $rid = 0) {
18        if(!$pid && $ts === 0) {
19            return new meta\AccessTableLookup($schema, $pid, $ts, $rid); // FIXME not mocked, yet
20        } else {
21            return new AccessTableData($schema, $pid, $ts);
22        }
23    }
24
25    public static function byTableName($tablename, $pid, $ts = 0, $rid = 0) {
26        $schema = new Schema($tablename, $ts);
27        return self::bySchema($schema, $pid, $ts); // becuse we have a static call here we can not rely on inheritance
28    }
29
30}
31