xref: /plugin/struct/_test/mock/AccessTable.php (revision 308cc83fd5391df29d21d2bc1306c8da49fdb335)
1<?php
2
3namespace dokuwiki\plugin\struct\test\mock;
4
5use dokuwiki\plugin\struct\meta;
6use dokuwiki\plugin\struct\meta\AccessTableGlobal;
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 AccessTablePage($schema, $pid, $ts, 0);
15    }
16
17    /**
18     * @param Schema $schema
19     * @param int|string $pid
20     * @param int $ts
21     * @param int $rid
22     * @return AccessTableGlobal|AccessTablePage
23     *@deprecated
24     */
25    public static function bySchema(Schema $schema, $pid, $ts = 0, $rid = 0) {
26        if (self::isTypePage($pid, $ts, $rid)) {
27            return new AccessTablePage($schema, $pid, $ts, $rid);
28        }
29        return new AccessTableGlobal($schema, $pid, $ts, $rid);
30    }
31
32    /**
33     * @param string $tablename
34     * @param string $pid
35     * @param int $ts
36     * @param int $rid
37     * @return meta\AccessTablePage|AccessTableGlobal|AccessTablePage
38     *@deprecated
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