public static function toListObjectVersions()

in src/Transform/BucketBasic.php [749:820]


    public static function toListObjectVersions(OperationOutput $output): Models\ListObjectVersionsResult
    {
        $result = new Models\ListObjectVersionsResult();
        $customDeserializer = [
            static function (Models\ListObjectVersionsResult $result, OperationOutput $output) {
                $body = $output->getBody() != null ? $output->getBody()->getContents() : '';
                Functions::assertXmlRoot($body, 'ListVersionsResult');
                $xml = Utils::parseXml($body);
                $result->encodingType = Functions::tryToString($xml->EncodingType);
                $decode = $result->encodingType === 'url';
                $result->name = Functions::tryToString($xml->Name);
                $result->prefix = Functions::tryUrldecodeString($xml->Prefix, $decode);
                $result->keyMarker = Functions::tryUrldecodeString($xml->KeyMarker, $decode);
                $result->versionIdMarker = Functions::tryToString($xml->VersionIdMarker);
                $result->maxKeys = Functions::tryToInt($xml->MaxKeys);
                $result->delimiter = Functions::tryUrldecodeString($xml->Delimiter, $decode);
                $result->isTruncated = Functions::tryToBool($xml->IsTruncated);
                $result->nextKeyMarker = Functions::tryUrldecodeString($xml->NextKeyMarker, $decode);
                $result->nextVersionIdMarker = Functions::tryToString($xml->NextVersionIdMarker);
                if (isset($xml->Version)) {
                    $result->versions = [];
                    foreach ($xml->Version as $version) {
                        $o = new Models\ObjectVersionProperties();
                        $o->key = Functions::tryUrldecodeString($version->Key, $decode);
                        $o->versionId = Functions::tryToString($version->VersionId);
                        $o->isLatest = Functions::tryToBool($version->IsLatest);
                        $o->type = Functions::tryToString($version->Type);
                        $o->size = Functions::tryToInt($version->Size);
                        $o->etag = Functions::tryToString($version->ETag);
                        $o->lastModified = Functions::tryToDatetime($version->LastModified, 'Y-m-d\TH:i:s.000\Z');
                        $o->storageClass = Functions::tryToString($version->StorageClass);
                        if (isset($version->Owner)) {
                            $o->owner = new Models\Owner(
                                Functions::tryToString($version->Owner->ID),
                                Functions::tryToString($version->Owner->DisplayName)
                            );
                        }
                        $o->restoreInfo = Functions::tryToString($version->RestoreInfo);
                        $o->transitionTime = Functions::tryToDatetime($version->TransitionTime, 'Y-m-d\TH:i:s.000\Z');
                        $result->versions[] = $o;
                    }
                }
                if (isset($xml->DeleteMarker)) {
                    $result->deleteMarkers = [];
                    foreach ($xml->DeleteMarker as $deleteMarker) {
                        $o = new Models\DeleteMarkerProperties();
                        $o->key = Functions::tryUrldecodeString($deleteMarker->Key, $decode);
                        $o->versionId = Functions::tryToString($deleteMarker->VersionId);
                        $o->isLatest = Functions::tryToBool($deleteMarker->IsLatest);
                        $o->lastModified = Functions::tryToDatetime($deleteMarker->LastModified, 'Y-m-d\TH:i:s.000\Z');
                        if (isset($deleteMarker->Owner)) {
                            $o->owner = new Models\Owner(
                                Functions::tryToString($deleteMarker->Owner->ID),
                                Functions::tryToString($deleteMarker->Owner->DisplayName)
                            );
                        }
                        $result->deleteMarkers[] = $o;
                    }
                }
                if (isset($xml->CommonPrefixes)) {
                    $result->commonPrefixes = [];
                    foreach ($xml->CommonPrefixes as $commonPrefix) {
                        $result->commonPrefixes[] = new Models\CommonPrefix(
                            Functions::tryUrldecodeString($commonPrefix->Prefix, $decode)
                        );
                    }
                }
            },
        ];
        Deserializer::deserializeOutput($result, $output, $customDeserializer);
        return $result;
    }