Command.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace GuzzleHttp\Command;
use GuzzleHttp\HandlerStack;
/**
* Default command implementation.
*/
class Command implements CommandInterface
{
use HasDataTrait;
/** @var string */
private $name;
/** @var HandlerStack */
private $handlerStack;
/**
* @param string $name Name of the command
* @param array $args Arguments to pass to the command
* @param HandlerStack $handlerStack Stack of middleware for the command
*/
public function __construct(
$name,
array $args = [],
HandlerStack $handlerStack = null
) {
$this->name = $name;
$this->data = $args;
$this->handlerStack = $handlerStack;
}
public function getHandlerStack()
{
return $this->handlerStack;
}
public function getName()
{
return $this->name;
}
public function hasParam($name)
{
return array_key_exists($name, $this->data);
}
public function __clone()
{
if ($this->handlerStack) {
$this->handlerStack = clone $this->handlerStack;
}
}
}