Example #1
0
 /**
  * Shortcut for executing Commands in the Definitions.
  *
  * @param string $method
  * @param array|null $args
  *
  * @return mixed|void
  *
  */
 public function __call($method, $args = null)
 {
     $commandName = ucfirst($method);
     $result = parent::__call($commandName, $args);
     // Remove data field
     if (is_array($result) && isset($result['data'])) {
         return $result['data'];
     }
     return $result;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function __call($method, $args = null)
 {
     if (substr($method, 0, 9) == 'waitUntil') {
         // Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($resource, $options))
         array_unshift($args, substr($method, 9));
         return call_user_func_array(array($this, 'waitUntil'), $args);
     } else {
         return parent::__call(ucfirst($method), $args);
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function __call($method, $args = [])
 {
     if (substr($method, -8) === 'Iterator') {
         // Allow magic method calls for iterators (e.g. $client-><CommandName>Iterator($params))
         $commandOptions = isset($args[0]) ? $args[0] : [];
         $iteratorOptions = isset($args[1]) ? $args[1] : [];
         $command = $this->getCommand(substr($method, 0, -8), $commandOptions);
         return new StripeCommandsCursorIterator($command, $iteratorOptions);
     }
     return parent::__call(ucfirst($method), $args);
 }
Example #4
0
 public function __call($method, $args)
 {
     if (substr($method, 0, 3) === 'get' && substr($method, -8) === 'Iterator') {
         // Allow magic method calls for iterators (e.g. $client->get<CommandName>Iterator($params))
         $commandOptions = isset($args[0]) ? $args[0] : null;
         $iteratorOptions = isset($args[1]) ? $args[1] : array();
         return $this->getIterator(substr($method, 3, -8), $commandOptions, $iteratorOptions);
     } elseif (substr($method, 0, 9) == 'waitUntil') {
         // Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($params))
         return $this->waitUntil(substr($method, 9), isset($args[0]) ? $args[0] : array());
     } else {
         return parent::__call(ucfirst($method), $args);
     }
 }
Example #5
0
 /**
  * Shortcut for executing Commands in the Definitions.
  *
  * @param string $method
  * @param array|null $args
  *
  * @return mixed|void
  *
  */
 public function __call($method, $args = null)
 {
     $commandName = ucfirst($method);
     $result = parent::__call($commandName, $args);
     return $result;
 }
 /**
  * {@inheritdoc}
  */
 public function __call($method, $args = null)
 {
     return parent::__call(ucfirst($method), $args);
 }
 public function __call($method, $args)
 {
     COMMONLOG(INFO, "enter %s ...", $method);
     $args = $this->setArgs($method, $args);
     if (substr($method, 0, 3) === 'get' && substr($method, -8) === 'Iterator') {
         // Allow magic method calls for iterators (e.g. $client->get<CommandName>Iterator($params))
         $commandOptions = isset($args[0]) ? $args[0] : null;
         $iteratorOptions = isset($args[1]) ? $args[1] : array();
         return $this->getIterator(substr($method, 3, -8), $commandOptions, $iteratorOptions);
     } elseif (substr($method, 0, 9) == 'waitUntil') {
         // Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($params))
         return $this->waitUntil(substr($method, 9), isset($args[0]) ? $args[0] : array());
     } else {
         try {
             if ($this->checkTransFile($method, $args)) {
                 if (ucfirst($method) === 'PutObject') {
                     $arr = $args;
                     unset($arr[0]['Bucket']);
                     unset($arr[0]['Key']);
                     unset($arr[0]['ACL']);
                     unset($arr[0]['SourceFile']);
                     $fp = fopen($args[0]['SourceFile'], 'rb');
                     return $this->upload($args[0]['Bucket'], $args[0]['Key'], $fp, $args[0]['ACL'], $arr);
                 }
                 $this->mkTempFile($args);
                 return $this->TransFile($method, $args);
             } else {
                 $ret = parent::__call(ucfirst($method), $args);
             }
         } catch (S3Exception $e) {
             throw $e;
         }
         if ("GetObject" === ucfirst($method)) {
             $this->WriteFile($ret, $args);
         }
         return $ret;
     }
 }
 /**
  * Shortcut for executing Commands in the Definitions.
  *
  * @param string $method
  * @param array $args
  *
  * @return mixed|void
  *
  */
 public function __call($method, $args)
 {
     $commandName = ucfirst($method);
     return parent::__call($commandName, $args);
 }
 /**
  * Exists solely to allow unit testing of the __call function above
  *
  * @param string $method
  * @param array $args
  * @return mixed
  */
 public function callParent($method, $args)
 {
     return parent::__call($method, $args);
 }