public static function create(array $parsedResponse, $location = '')
    {
        $result               = new ListDirectoriesAndFilesResult();
        $serviceEndpoint      = Utilities::tryGetKeysChainValue(
            $parsedResponse,
            Resources::XTAG_ATTRIBUTES,
            Resources::XTAG_SERVICE_ENDPOINT
        );
        $result->setAccountName(Utilities::tryParseAccountNameFromUrl(
            $serviceEndpoint
        ));

        $nextMarker = Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_NEXT_MARKER
        );

        if ($nextMarker != null) {
            $result->setContinuationToken(
                new MarkerContinuationToken(
                    $nextMarker,
                    $location
                )
            );
        }

        $result->setMaxResults(Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_MAX_RESULTS
        ));

        $result->setMarker(Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_MARKER
        ));

        $entries = Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_ENTRIES
        );

        if (empty($entries)) {
            $result->setDirectories(array());
            $result->setFiles(array());
        } else {
            $directoriesArray = Utilities::tryGetValue(
                $entries,
                Resources::QP_DIRECTORY
            );
            $filesArray = Utilities::tryGetValue(
                $entries,
                Resources::QP_FILE
            );

            $directories = array();
            $files = array();

            if ($directoriesArray != null) {
                if (array_key_exists(Resources::QP_NAME, $directoriesArray)) {
                    $directoriesArray = [$directoriesArray];
                }
                foreach ($directoriesArray as $directoryArray) {
                    $directories[] = Directory::create($directoryArray);
                }
            }

            if ($filesArray != null) {
                if (array_key_exists(Resources::QP_NAME, $filesArray)) {
                    $filesArray = [$filesArray];
                }
                foreach ($filesArray as $fileArray) {
                    $files[] = File::create($fileArray);
                }
            }

            $result->setDirectories($directories);
            $result->setFiles($files);
        }

        return $result;
    }
public static function create(array $parsedResponse, $location = '')
    {
        $result               = new ListDirectoriesAndFilesResult();
        $serviceEndpoint      = Utilities::tryGetKeysChainValue(
            $parsedResponse,
            Resources::XTAG_ATTRIBUTES,
            Resources::XTAG_SERVICE_ENDPOINT
        );
        $result->setAccountName(Utilities::tryParseAccountNameFromUrl(
            $serviceEndpoint
        ));

        $nextMarker = Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_NEXT_MARKER
        );

        if ($nextMarker != null) {
            $result->setContinuationToken(
                new MarkerContinuationToken(
                    $nextMarker,
                    $location
                )
            );
        }

        $result->setMaxResults(Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_MAX_RESULTS
        ));

        $result->setMarker(Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_MARKER
        ));

        $entries = Utilities::tryGetValue(
            $parsedResponse,
            Resources::QP_ENTRIES
        );

        if (empty($entries)) {
            $result->setDirectories(array());
            $result->setFiles(array());
        } else {
            $directoriesArray = Utilities::tryGetValue(
                $entries,
                Resources::QP_DIRECTORY
            );
            $filesArray = Utilities::tryGetValue(
                $entries,
                Resources::QP_FILE
            );

            $directories = array();
            $files = array();

            if ($directoriesArray != null) {
                if (array_key_exists(Resources::QP_NAME, $directoriesArray)) {
                    $directoriesArray = [$directoriesArray];
                }
                foreach ($directoriesArray as $directoryArray) {
                    $directories[] = Directory::create($directoryArray);
                }
            }

            if ($filesArray != null) {
                if (array_key_exists(Resources::QP_NAME, $filesArray)) {
                    $filesArray = [$filesArray];
                }
                foreach ($filesArray as $fileArray) {
                    $files[] = File::create($fileArray);
                }
            }

            $result->setDirectories($directories);
            $result->setFiles($files);
        }

        return $result;
    }
public static function create ( array $ parsedResponse , $ location = '' ) { $ result = new ListDirectoriesAndFilesResult ( ) ; $ serviceEndpoint = Utilities :: tryGetKeysChainValue ( $ parsedResponse , Resources :: XTAG_ATTRIBUTES , Resources :: XTAG_SERVICE_ENDPOINT ) ; $ result -> setAccountName ( Utilities :: tryParseAccountNameFromUrl ( $ serviceEndpoint ) ) ; $ nextMarker = Utilities :: tryGetValue ( $ parsedResponse , Resources :: QP_NEXT_MARKER ) ; if ( $ nextMarker != null ) { $ result -> setContinuationToken ( new MarkerContinuationToken ( $ nextMarker , $ location ) ) ; } $ result -> setMaxResults ( Utilities :: tryGetValue ( $ parsedResponse , Resources :: QP_MAX_RESULTS ) ) ; $ result -> setMarker ( Utilities :: tryGetValue ( $ parsedResponse , Resources :: QP_MARKER ) ) ; $ entries = Utilities :: tryGetValue ( $ parsedResponse , Resources :: QP_ENTRIES ) ; if ( empty ( $ entries ) ) { $ result -> setDirectories ( array ( ) ) ; $ result -> setFiles ( array ( ) ) ; } else { $ directoriesArray = Utilities :: tryGetValue ( $ entries , Resources :: QP_DIRECTORY ) ; $ filesArray = Utilities :: tryGetValue ( $ entries , Resources :: QP_FILE ) ; $ directories = array ( ) ; $ files = array ( ) ; if ( $ directoriesArray != null ) { if ( array_key_exists ( Resources :: QP_NAME , $ directoriesArray ) ) { $ directoriesArray = [ $ directoriesArray ] ; } foreach ( $ directoriesArray as $ directoryArray ) { $ directories [ ] = Directory :: create ( $ directoryArray ) ; } } if ( $ filesArray != null ) { if ( array_key_exists ( Resources :: QP_NAME , $ filesArray ) ) { $ filesArray = [ $ filesArray ] ; } foreach ( $ filesArray as $ fileArray ) { $ files [ ] = File :: create ( $ fileArray ) ; } } $ result -> setDirectories ( $ directories ) ; $ result -> setFiles ( $ files ) ; } return $ result ; }
Creates ListDirectoriesAndFilesResult object from parsed XML response.

@param array  $parsedResponse XML response parsed into array.
@param string $location       Contains the location for the previous
request.

@internal

@return ListDirectoriesAndFilesResult
Creates ListDirectoriesAndFilesResult object from parsed XML response .