Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
    private $name;
12
    private $name;
Línea 13... Línea 13...
13
 
13
 
14
    /** @var HandlerList */
14
    /** @var HandlerList */
Línea 15... Línea 15...
15
    private $handlerList;
15
    private $handlerList;
16
 
16
 
Línea -... Línea 17...
-
 
17
    /** @var array */
-
 
18
    private $authSchemes;
-
 
19
 
17
    /** @var Array */
20
    /** @var MetricsBuilder */
18
    private $authSchemes;
21
    private $metricsBuilder;
19
 
22
 
20
    /**
23
    /**
21
     * Accepts an associative array of command options, including:
24
     * Accepts an associative array of command options, including:
22
     *
25
     *
23
     * - @http: (array) Associative array of transfer options.
26
     * - @http: (array) Associative array of transfer options.
24
     *
27
     *
25
     * @param string      $name           Name of the command
28
     * @param string      $name           Name of the command
-
 
29
     * @param array       $args           Arguments to pass to the command
-
 
30
     * @param HandlerList $list           Handler list
-
 
31
     */
26
     * @param array       $args           Arguments to pass to the command
32
    public function __construct(
-
 
33
        $name,
-
 
34
        array $args = [],
27
     * @param HandlerList $list           Handler list
35
        ?HandlerList $list = null,
28
     */
36
        ?MetricsBuilder $metricsBuilder = null
29
    public function __construct($name, array $args = [], HandlerList $list = null)
37
    )
30
    {
38
    {
Línea 36... Línea 44...
36
            $this->data['@http'] = [];
44
            $this->data['@http'] = [];
37
        }
45
        }
38
        if (!isset($this->data['@context'])) {
46
        if (!isset($this->data['@context'])) {
39
            $this->data['@context'] = [];
47
            $this->data['@context'] = [];
40
        }
48
        }
-
 
49
        $this->metricsBuilder = $metricsBuilder ?: new MetricsBuilder();
41
    }
50
    }
Línea 42... Línea 51...
42
 
51
 
43
    public function __clone()
52
    public function __clone()
44
    {
53
    {
Línea 64... Línea 73...
64
     * For overriding auth schemes on a per endpoint basis when using
73
     * For overriding auth schemes on a per endpoint basis when using
65
     * EndpointV2 provider. Intended for internal use only.
74
     * EndpointV2 provider. Intended for internal use only.
66
     *
75
     *
67
     * @param array $authSchemes
76
     * @param array $authSchemes
68
     *
77
     *
-
 
78
     * @deprecated In favor of using the @context property bag.
-
 
79
     *             Auth Schemes are now accessible via the `signature_version` key
-
 
80
     *             in a Command's context, if applicable. Auth Schemes set using
-
 
81
     *             This method are no longer consumed.
-
 
82
     *
69
     * @internal
83
     * @internal
70
     */
84
     */
71
    public function setAuthSchemes(array $authSchemes)
85
    public function setAuthSchemes(array $authSchemes)
72
    {
86
    {
-
 
87
        trigger_error(__METHOD__ . ' is deprecated.  Auth schemes '
-
 
88
            . 'resolved using the service `auth` trait or via endpoint resolution '
-
 
89
            . 'are now set in the command `@context` property.`'
-
 
90
            , E_USER_WARNING
-
 
91
        );
-
 
92
 
73
        $this->authSchemes = $authSchemes;
93
        $this->authSchemes = $authSchemes;
74
    }
94
    }
Línea 75... Línea 95...
75
 
95
 
76
    /**
96
    /**
77
     * Get auth schemes added to command as required
97
     * Get auth schemes added to command as required
78
     * for endpoint resolution
98
     * for endpoint resolution
79
     *
99
     *
-
 
100
     * @returns array
-
 
101
     *
-
 
102
     * @deprecated In favor of using the @context property bag.
-
 
103
     *             Auth schemes are now accessible via the `signature_version` key
80
     * @returns array | null
104
     *             in a Command's context, if applicable.
81
     */
105
     */
82
    public function getAuthSchemes()
106
    public function getAuthSchemes()
-
 
107
    {
-
 
108
        trigger_error(__METHOD__ . ' is deprecated.  Auth schemes '
-
 
109
        . 'resolved using the service `auth` trait or via endpoint resolution '
-
 
110
        . 'can now be found in the command `@context` property.`'
-
 
111
        , E_USER_WARNING
-
 
112
        );
83
    {
113
 
84
        return $this->authSchemes;
114
        return $this->authSchemes ?: [];
Línea 85... Línea 115...
85
    }
115
    }
86
 
116
 
87
    /** @deprecated */
117
    /** @deprecated */
88
    public function get($name)
118
    public function get($name)
89
    {
119
    {
-
 
120
        return $this[$name];
-
 
121
    }
-
 
122
 
-
 
123
    /**
-
 
124
     * Returns the metrics builder instance tied up to this command.
-
 
125
     *
-
 
126
     * @internal
-
 
127
     *
-
 
128
     * @return MetricsBuilder
-
 
129
     */
-
 
130
    public function getMetricsBuilder(): MetricsBuilder
-
 
131
    {
90
        return $this[$name];
132
        return $this->metricsBuilder;