1<?php 2 3namespace dokuwiki\test\Remote\Mock; 4 5 6use dokuwiki\Remote\ApiCall; 7 8class ApiCore 9{ 10 11 function getMethods() 12 { 13 return [ 14 'wiki.stringTestMethod' => new ApiCall([$this, 'stringTestMethod']), 15 'wiki.intTestMethod' => new ApiCall([$this, 'intTestMethod']), 16 'wiki.floatTestMethod' => new ApiCall([$this, 'floatTestMethod']), 17 'wiki.dateTestMethod' => new ApiCall([$this, 'dateTestMethod']), 18 'wiki.fileTestMethod' => new ApiCall([$this, 'fileTestMethod']), 19 'wiki.voidTestMethod' => new ApiCall([$this, 'voidTestMethod']), 20 'wiki.oneStringArgMethod' => new ApiCall([$this, 'oneStringArgMethod']), 21 'wiki.twoArgMethod' => new ApiCall([$this, 'twoArgMethod']), 22 'wiki.twoArgWithDefaultArg' => new ApiCall([$this, 'twoArgWithDefaultArg']), 23 'wiki.publicCall' => (new ApiCall([$this, 'publicCall']))->setPublic(), 24 ]; 25 26 /* 27 array( 28 'wiki.stringTestMethod' => array( 29 'args' => array(), 30 'return' => 'string', 31 'doc' => 'Test method', 32 'name' => 'stringTestMethod', 33 ), 'wiki.intTestMethod' => array( 34 'args' => array(), 35 'return' => 'int', 36 'doc' => 'Test method', 37 'name' => 'intTestMethod', 38 ), 'wiki.floatTestMethod' => array( 39 'args' => array(), 40 'return' => 'float', 41 'doc' => 'Test method', 42 'name' => 'floatTestMethod', 43 ), 'wiki.dateTestMethod' => array( 44 'args' => array(), 45 'return' => 'date', 46 'doc' => 'Test method', 47 'name' => 'dateTestMethod', 48 ), 'wiki.fileTestMethod' => array( 49 'args' => array(), 50 'return' => 'file', 51 'doc' => 'Test method', 52 'name' => 'fileTestMethod', 53 ), 'wiki.voidTestMethod' => array( 54 'args' => array(), 55 'return' => 'void', 56 'doc' => 'Test method', 57 'name' => 'voidTestMethod', 58 ), 'wiki.oneStringArgMethod' => array( 59 'args' => array('string'), 60 'return' => 'string', 61 'doc' => 'Test method', 62 'name' => 'oneStringArgMethod', 63 ), 'wiki.twoArgMethod' => array( 64 'args' => array('string', 'int'), 65 'return' => 'array', 66 'doc' => 'Test method', 67 'name' => 'twoArgMethod', 68 ), 'wiki.twoArgWithDefaultArg' => array( 69 'args' => array('string', 'string'), 70 'return' => 'string', 71 'doc' => 'Test method', 72 'name' => 'twoArgWithDefaultArg', 73 ), 'wiki.publicCall' => array( 74 'args' => array(), 75 'return' => 'boolean', 76 'doc' => 'testing for public access', 77 'name' => 'publicCall', 78 'public' => 1 79 ) 80 ); 81 */ 82 } 83 84 function stringTestMethod() 85 { 86 return 'success'; 87 } 88 89 function intTestMethod() 90 { 91 return 42; 92 } 93 94 function floatTestMethod() 95 { 96 return 3.14159265; 97 } 98 99 function dateTestMethod() 100 { 101 return 2623452346; 102 } 103 104 function fileTestMethod() 105 { 106 return 'file content'; 107 } 108 109 function voidTestMethod() 110 { 111 return null; 112 } 113 114 function oneStringArgMethod($arg) 115 { 116 return $arg; 117 } 118 119 function twoArgMethod($string, $int) 120 { 121 return array($string, $int); 122 } 123 124 function twoArgWithDefaultArg($string1, $string2 = 'default') 125 { 126 return array($string1, $string2); 127 } 128 129 function publicCall() 130 { 131 return true; 132 } 133 134} 135