Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace fake_fullfeatured\external;
18
 
19
use core_external\external_api;
20
use core_external\external_function_parameters;
21
use core_external\external_single_structure;
22
use core_external\external_value;
23
 
24
/**
25
 * Mock external service.
26
 *
27
 * @package   core
28
 * @copyright 2024 Jake Dallimore <jrhdallimore@gmail.com>
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class service_test extends external_api {
32
    /**
33
     * Returns description of method parameters.
34
     *
35
     * @return external_function_parameters
36
     */
37
    public static function execute_parameters(): external_function_parameters {
38
        return new external_function_parameters([]);
39
    }
40
 
41
    /**
42
     * The mock service.
43
     *
44
     * @return array
45
     */
46
    public static function execute(): array {
47
        return ['result' => 'fake_fullfeatured service result'];
48
    }
49
 
50
    /**
51
     * Describe the return structure of the external service.
52
     *
53
     * @return external_single_structure
54
     */
55
    public static function execute_returns(): external_single_structure {
56
        return new external_single_structure([
57
            'result' => new external_value(PARAM_TEXT, 'The result string'),
58
        ]);
59
    }
60
}