You are here

public function S3Adapter::has in Flysystem - S3 2.0.x

Same name and namespace in other branches
  1. 8 src/Flysystem/Adapter/S3Adapter.php \Drupal\flysystem_s3\Flysystem\Adapter\S3Adapter::has()

File

src/Flysystem/Adapter/S3Adapter.php, line 19

Class

S3Adapter
Overrides methods so it works with Drupal.

Namespace

Drupal\flysystem_s3\Flysystem\Adapter

Code

public function has($path) {
  $location = $this
    ->applyPathPrefix($path);
  if ($this->s3Client
    ->doesObjectExist($this->bucket, $location, $this->options)) {
    return TRUE;
  }
  if ($this->s3Client
    ->doesObjectExist($this->bucket, $location . '/') === TRUE) {
    return TRUE;
  }
  else {
    return $this
      ->doesDirectoryExist($location);
  }
}