| 1 |
<?php |
| 2 |
|
| 3 |
namespace Dudlewebs\WPMCS\s3\Aws; |
| 4 |
|
| 5 |
/** |
| 6 |
* AWS command object. |
| 7 |
*/ |
| 8 |
class Command implements CommandInterface |
| 9 |
{ |
| 10 |
use HasDataTrait; |
| 11 |
/** @var string */ |
| 12 |
private $name; |
| 13 |
/** @var HandlerList */ |
| 14 |
private $handlerList; |
| 15 |
/** |
| 16 |
* Accepts an associative array of command options, including: |
| 17 |
* |
| 18 |
* - @http: (array) Associative array of transfer options. |
| 19 |
* |
| 20 |
* @param string $name Name of the command |
| 21 |
* @param array $args Arguments to pass to the command |
| 22 |
* @param HandlerList $list Handler list |
| 23 |
*/ |
| 24 |
public function __construct($name, array $args = [], HandlerList $list = null) |
| 25 |
{ |
| 26 |
$this->name = $name; |
| 27 |
$this->data = $args; |
| 28 |
$this->handlerList = $list ?: new HandlerList(); |
| 29 |
if (!isset($this->data['@http'])) { |
| 30 |
$this->data['@http'] = []; |
| 31 |
} |
| 32 |
if (!isset($this->data['@context'])) { |
| 33 |
$this->data['@context'] = []; |
| 34 |
} |
| 35 |
} |
| 36 |
public function __clone() |
| 37 |
{ |
| 38 |
$this->handlerList = clone $this->handlerList; |
| 39 |
} |
| 40 |
public function getName() |
| 41 |
{ |
| 42 |
return $this->name; |
| 43 |
} |
| 44 |
public function hasParam($name) |
| 45 |
{ |
| 46 |
return \array_key_exists($name, $this->data); |
| 47 |
} |
| 48 |
public function getHandlerList() |
| 49 |
{ |
| 50 |
return $this->handlerList; |
| 51 |
} |
| 52 |
/** @deprecated */ |
| 53 |
public function get($name) |
| 54 |
{ |
| 55 |
return $this[$name]; |
| 56 |
} |
| 57 |
} |
| 58 |
|