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 core\router\parameters;
18
 
19
use core\param;
20
use core\router\schema\example;
21
use core\router\schema\referenced_object;
22
 
23
/**
24
 * A component path parameter.
25
 *
26
 * @package    core
27
 * @copyright  2023 Andrew Lyons <andrew@nicols.co.uk>
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 */
30
class path_component extends \core\router\schema\parameters\path_parameter implements referenced_object {
31
    /**
32
     * Create a new path_component parameter.
33
     *
34
     * @param string $name The name of the parameter to use for the component name
35
     * @param mixed ...$extra Additional arguments
36
     */
37
    public function __construct(
38
        string $name = 'component',
39
        ...$extra,
40
    ) {
41
        $extra['name'] = $name;
42
        $extra['type'] = param::COMPONENT;
43
        $extra['description'] = 'The name of a Moodle component, in frankenstyle format.';
44
        $extra['examples'] = [
45
            new example(
46
                name: 'The core subsystem',
47
                value: 'core',
48
            ),
49
            new example(
50
                name: 'The Course subsystem',
51
                value: 'core_course',
52
            ),
53
            new example(
54
                name: 'An activity module',
55
                value: 'mod_assign',
56
            ),
57
            new example(
58
                name: 'An assignment subplugin',
59
                value: 'assignsubmission_file',
60
            ),
61
        ];
62
 
63
        parent::__construct(...$extra);
64
    }
65
}