Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
namespace Aws;
3
 
4
/**
5
 * AWS command object.
6
 */
7
class Command implements CommandInterface
8
{
9
    use HasDataTrait;
10
 
11
    /** @var string */
12
    private $name;
13
 
14
    /** @var HandlerList */
15
    private $handlerList;
16
 
17
    /** @var Array */
18
    private $authSchemes;
19
 
20
    /**
21
     * Accepts an associative array of command options, including:
22
     *
23
     * - @http: (array) Associative array of transfer options.
24
     *
25
     * @param string      $name           Name of the command
26
     * @param array       $args           Arguments to pass to the command
27
     * @param HandlerList $list           Handler list
28
     */
29
    public function __construct($name, array $args = [], HandlerList $list = null)
30
    {
31
        $this->name = $name;
32
        $this->data = $args;
33
        $this->handlerList = $list ?: new HandlerList();
34
 
35
        if (!isset($this->data['@http'])) {
36
            $this->data['@http'] = [];
37
        }
38
        if (!isset($this->data['@context'])) {
39
            $this->data['@context'] = [];
40
        }
41
    }
42
 
43
    public function __clone()
44
    {
45
        $this->handlerList = clone $this->handlerList;
46
    }
47
 
48
    public function getName()
49
    {
50
        return $this->name;
51
    }
52
 
53
    public function hasParam($name)
54
    {
55
        return array_key_exists($name, $this->data);
56
    }
57
 
58
    public function getHandlerList()
59
    {
60
        return $this->handlerList;
61
    }
62
 
63
    /**
64
     * For overriding auth schemes on a per endpoint basis when using
65
     * EndpointV2 provider. Intended for internal use only.
66
     *
67
     * @param array $authSchemes
68
     *
69
     * @internal
70
     */
71
    public function setAuthSchemes(array $authSchemes)
72
    {
73
        $this->authSchemes = $authSchemes;
74
    }
75
 
76
    /**
77
     * Get auth schemes added to command as required
78
     * for endpoint resolution
79
     *
80
     * @returns array | null
81
     */
82
    public function getAuthSchemes()
83
    {
84
        return $this->authSchemes;
85
    }
86
 
87
    /** @deprecated */
88
    public function get($name)
89
    {
90
        return $this[$name];
91
    }
92
}