/**
  * {@inheritdoc}
  */
 public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId)
 {
     $transferState = new self($uploadId);
     foreach ($client->getIterator('ListParts', $uploadId->toParams()) as $part) {
         $transferState->addPart(UploadPart::fromArray($part));
     }
     return $transferState;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId)
 {
     $transferState = new static($uploadId);
     $listParts = $client->getIterator('ListParts', $uploadId->toParams());
     foreach ($listParts as $part) {
         list($firstByte, $lastByte) = explode('-', $part['RangeInBytes']);
         $partSize = (double) $listParts->getLastResult()->get('PartSizeInBytes');
         $partData = array('partNumber' => $firstByte / $partSize + 1, 'checksum' => $part['SHA256TreeHash'], 'contentHash' => self::ALREADY_UPLOADED, 'size' => $lastByte - $firstByte + 1, 'offset' => $firstByte);
         $transferState->addPart(UploadPart::fromArray($partData));
     }
     return $transferState;
 }