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