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