make deleteWithObjects() work with empty containers

As is, deleteWithObjects() will fail if container is EMPTY. This is because an object count of zero means $secondsToWait = 0, which means $endTime = time(), which means WHILE loop never runs. Quickest solution was to change "time() __<__ $endTime" to "time() __<=__ $endTime" on line 192, but it makes more sense to just delete the container if it's empty.

 Even awesomer!



 On Sun, 07 Dec 2014 14:28:28 -0800, Shaunak Kashyap 
 <notifications@github.com> wrote:
> In lib/OpenCloud/ObjectStore/Resource/Container.php:
>
>> - // Attempt to delete all objects and container
>> - $endTime = time() + $secondsToWait;
>> - $containerDeleted = false;
>> - while ((time() < $endTime) && !$containerDeleted) {
>> - $this->deleteAllObjects();
>> - try {
>> - $response = $this->delete();
>> - $containerDeleted = true;
>> - } catch (ContainerException $e) {
>> - // Ignore exception and try again
>> - } catch (ClientErrorResponseException $e) {
>> - if ($e->getResponse()->getStatusCode() == 404) {
>> - // Container has been deleted
>> + // If container is empty, just delete it
>> + $numObjects = (int)
> $this->retrieveMetadata()->getProperty('Object-Count');
>> + if ($numObjects === 0) $response = $this->delete();
>
> Rather than this if-else construction, you can just return early from
> inside the if. So something like this:
>
> if ($numObjects === 0) {
>  return $this->delete();
>  }
>
> // If timeout (seconds to wait) is not specified by caller, try to
>  // estimate it based on number of objects in container
>  // ...
>
> --
> Reply to this email directly or view it on GitHub [1].
>
> 	*
>
> Links:
> ------
> [1]
> https://github.com/rackspace/php-opencloud/pull/490/files#r21429173