コード例 #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
ファイル: ApiCommandTest.php プロジェクト: jsnshrmn/Suma
 protected function getApiCommand()
 {
     return ApiCommand::fromCommand(get_class($this));
 }