xref: /plugin/struct/_test/mock/AccessTable.php (revision 4fc908c26a1ba87b8658df684b82b191fd852c45)
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    public static function getPageAccess($tablename, $pid, $ts = 0)
12    {
13        $schema = new Schema($tablename, $ts);
14        return new AccessTableData($schema, $pid, $ts, 0);
15    }
16
17    /**
18     * @deprecated
19     * @param Schema $schema
20     * @param int|string $pid
21     * @param int $ts
22     * @param int $rid
23     * @return AccessTableLookup|AccessTableData
24     */
25    public static function bySchema(Schema $schema, $pid, $ts = 0, $rid = 0) {
26        if (self::isTypePage($pid, $ts, $rid)) {
27            return new AccessTableData($schema, $pid, $ts, $rid);
28        }
29        return new AccessTableLookup($schema, $pid, $ts, $rid);
30    }
31
32    /**
33     * @deprecated
34     * @param string $tablename
35     * @param string $pid
36     * @param int $ts
37     * @param int $rid
38     * @return meta\AccessTableData|AccessTableLookup|AccessTableData
39     */
40    public static function byTableName($tablename, $pid, $ts = 0, $rid = 0) {
41        $schema = new Schema($tablename, $ts);
42        return self::bySchema($schema, $pid, $ts); // becuse we have a static call here we can not rely on inheritance
43    }
44
45}
46