public static function toListObjects()

in src/Transform/BucketBasic.php [536:586]


    public static function toListObjects(OperationOutput $output): Models\ListObjectsResult
    {
        $result = new Models\ListObjectsResult();
        $customDeserializer = [
            static function (Models\ListObjectsResult $result, OperationOutput $output) {
                $body = $output->getBody() != null ? $output->getBody()->getContents() : '';
                Functions::assertXmlRoot($body, 'ListBucketResult');
                $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->marker = Functions::tryUrldecodeString($xml->Marker, $decode);
                $result->maxKeys = Functions::tryToInt($xml->MaxKeys);
                $result->delimiter = Functions::tryUrldecodeString($xml->Delimiter, $decode);
                $result->isTruncated = Functions::tryToBool($xml->IsTruncated);
                $result->nextMarker = Functions::tryUrldecodeString($xml->NextMarker, $decode);
                if (isset($xml->Contents)) {
                    $result->contents = [];
                    foreach ($xml->Contents as $content) {
                        $o = new Models\ObjectProperties();
                        $o->key = Functions::tryUrldecodeString($content->Key, $decode);
                        $o->type = Functions::tryToString($content->Type);
                        $o->size = Functions::tryToInt($content->Size);
                        $o->etag = Functions::tryToString($content->ETag);
                        $o->lastModified = Functions::tryToDatetime($content->LastModified, 'Y-m-d\TH:i:s.000\Z');
                        $o->storageClass = Functions::tryToString($content->StorageClass);
                        if (isset($content->Owner)) {
                            $o->owner = new Models\Owner(
                                Functions::tryToString($content->Owner->ID),
                                Functions::tryToString($content->Owner->DisplayName)
                            );
                        }
                        $o->restoreInfo = Functions::tryToString($content->RestoreInfo);
                        $o->transitionTime = Functions::tryToDatetime($content->TransitionTime, 'Y-m-d\TH:i:s.000\Z');
                        $result->contents[] = $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;
    }