Exemple #1
0
 private function getCanonicalizedParameterString(PostBodyInterface $body)
 {
     $params = $body->getFields();
     unset($params['Signature']);
     uksort($params, 'strcmp');
     $str = '';
     foreach ($params as $key => $val) {
         $str .= rawurlencode($key) . '=' . rawurlencode($val) . '&';
     }
     return substr($str, 0, -1);
 }
 /**
  * Add a file to the postBody.
  *
  * @param PostBodyInterface $postBody
  * @param string            $fieldName
  * @param string|array      $filePath
  */
 private function addFile(PostBodyInterface $postBody, $fieldName, $filePath)
 {
     $filename = null;
     // Backward compatibility code
     if (is_array($filePath)) {
         $filename = $filePath['remoteName'];
         $filePath = $filePath['filePath'];
     }
     // Remove leading @ symbol
     if (strpos($filePath, '@') === 0) {
         $filePath = substr($filePath, 1);
     }
     $postBody->addFile(new PostFile($fieldName, fopen($filePath, 'r'), $filename));
 }