lib/Beberlei/AzureBlobStorage/BlobClient.php
public function listContainers($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
    {
        // Build query string
        $query = array('comp' => 'list');
        if (!is_null($prefix)) {
            $query['prefix'] = $prefix;
        }
        if (!is_null($maxResults)) {
            $query['maxresults'] = $maxResults;
        }
        if (!is_null($marker)) {
            $query['marker'] = $marker;
        }
        if (!is_null($include)) {
            $query['include'] = $include;
        }

        $response = $this->performRequest('', $query, 'GET', array(), false, null, self::RESOURCE_CONTAINER, self::PERMISSION_LIST);
        if ( ! $response->isSuccessful()) {
            throw new BlobException($this->getErrorMessage($response, 'Resource could not be accessed.'));
        }

        $xmlContainers = $this->parseResponse($response)->Containers->Container;
        $xmlMarker = (string)$this->parseResponse($response)->NextMarker;

        $containers = array();
        if (!is_null($xmlContainers)) {
            for ($i = 0; $i < count($xmlContainers); $i++) {
                $containers[] = new BlobContainer(
                        (string)$xmlContainers[$i]->Name,
                        (string)$xmlContainers[$i]->Etag,
                        (string)$xmlContainers[$i]->LastModified,
                        $this->parseMetadataElement($xmlContainers[$i])
                        );
            }
        }
        $currentResultCount = $currentResultCount + count($containers);
        if (!is_null($maxResults) && $currentResultCount < $maxResults) {
            if (!is_null($xmlMarker) && $xmlMarker != '') {
                $containers = array_merge($containers, $this->listContainers($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
            }
        }
        if (!is_null($maxResults) && count($containers) > $maxResults) {
            $containers = array_slice($containers, 0, $maxResults);
        }

        return $containers;
    }
public function listContainers($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
    {
        // Build query string
        $query = array('comp' => 'list');
        if (!is_null($prefix)) {
            $query['prefix'] = $prefix;
        }
        if (!is_null($maxResults)) {
            $query['maxresults'] = $maxResults;
        }
        if (!is_null($marker)) {
            $query['marker'] = $marker;
        }
        if (!is_null($include)) {
            $query['include'] = $include;
        }

        $response = $this->performRequest('', $query, 'GET', array(), false, null, self::RESOURCE_CONTAINER, self::PERMISSION_LIST);
        if ( ! $response->isSuccessful()) {
            throw new BlobException($this->getErrorMessage($response, 'Resource could not be accessed.'));
        }

        $xmlContainers = $this->parseResponse($response)->Containers->Container;
        $xmlMarker = (string)$this->parseResponse($response)->NextMarker;

        $containers = array();
        if (!is_null($xmlContainers)) {
            for ($i = 0; $i < count($xmlContainers); $i++) {
                $containers[] = new BlobContainer(
                        (string)$xmlContainers[$i]->Name,
                        (string)$xmlContainers[$i]->Etag,
                        (string)$xmlContainers[$i]->LastModified,
                        $this->parseMetadataElement($xmlContainers[$i])
                        );
            }
        }
        $currentResultCount = $currentResultCount + count($containers);
        if (!is_null($maxResults) && $currentResultCount < $maxResults) {
            if (!is_null($xmlMarker) && $xmlMarker != '') {
                $containers = array_merge($containers, $this->listContainers($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
            }
        }
        if (!is_null($maxResults) && count($containers) > $maxResults) {
            $containers = array_slice($containers, 0, $maxResults);
        }

        return $containers;
    }
List containers

@param string $prefix     Optional. Filters the results to return only containers whose name begins with the specified prefix.
@param int    $maxResults Optional. Specifies the maximum number of containers to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
@param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
@param string $include    Optional. Include this parameter to specify that the container's metadata be returned as part of the response body. (allowed values: '', 'metadata')
@param int    $currentResultCount Current result count (internal use)
@return array
@throws BlobException