예제 #1
0
 /**
  * Constructor
  *
  * @param array|Collection    $parameters Collection of parameters to set on the command
  * @param ApiCommandInterface $apiCommand Command definition from description
  */
 public function __construct($parameters = null, ApiCommandInterface $apiCommand = null)
 {
     parent::__construct($parameters);
     $this->apiCommand = $apiCommand ?: ApiCommand::fromCommand(get_class($this));
     $this->initConfig();
     $headers = $this->get(self::HEADERS_OPTION);
     if (!$headers instanceof Collection) {
         $this->set(self::HEADERS_OPTION, new Collection((array) $headers));
     }
     // You can set a command.on_complete option in your parameters as a
     // convenience method for setting an onComplete function
     $onComplete = $this->get('command.on_complete');
     if ($onComplete) {
         $this->remove('command.on_complete');
         $this->setOnComplete($onComplete);
     }
     $this->init();
 }
예제 #2
0
 protected function getApiCommand()
 {
     return ApiCommand::fromCommand(get_class($this));
 }