Пример #1
0
 /**
  * Determines whether or not a resource exists using a command
  *
  * @param CommandInterface $command   Command used to poll for the resource
  * @param bool             $accept403 Set to true if 403s are acceptable
  *
  * @return bool
  * @throws S3Exception|\Exception if there is an unhandled exception
  */
 protected function checkExistenceWithCommand(CommandInterface $command, $accept403 = false)
 {
     try {
         $command->execute();
         $exists = true;
     } catch (AccessDeniedException $e) {
         $exists = (bool) $accept403;
     } catch (S3Exception $e) {
         $exists = false;
         if ($e->getResponse()->getStatusCode() >= 500) {
             // @codeCoverageIgnoreStart
             throw $e;
             // @codeCoverageIgnoreEnd
         }
     }
     return $exists;
 }