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