xref: /plugin/struct/_test/mock/AccessTable.php (revision 76a74c230f7336dce2880f047cb3dbd1a2e8f0e7)
1<?php
2
3namespace dokuwiki\plugin\struct\test\mock;
4
5use dokuwiki\plugin\struct\meta;
6use dokuwiki\plugin\struct\meta\AccessTableLookup;
7use dokuwiki\plugin\struct\meta\Schema;
8
9abstract class AccessTable extends meta\AccessTable {
10
11    /**
12     * @param Schema $schema
13     * @param int|string $pid
14     * @param int $ts
15     * @param int $rid
16     * @return AccessTableLookup|AccessTableData
17     */
18    public static function bySchema(Schema $schema, $pid, $ts = 0, $rid = 0) {
19        if (self::isTypePage($pid, $ts, $rid)) {
20            return new AccessTableData($schema, $pid, $ts, $rid);
21        }
22        return new AccessTableLookup($schema, $pid, $ts, $rid);
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