Exemplo n.º 1
0
 /**
  * Construct a new stream wrapper.
  *
  * @param \Drupal\amazons3\StreamWrapperConfiguration $config
  *   (optional) A specific configuration to use for this wrapper.
  */
 public function __construct(StreamWrapperConfiguration $config = NULL)
 {
     if (!$config) {
         if (static::$defaultConfig) {
             $config = static::$defaultConfig;
         } else {
             // @codeCoverageIgnoreStart
             $config = StreamWrapperConfiguration::fromDrupalVariables();
             // @codeCoverageIgnoreEnd
         }
     }
     $this->config = $config;
     if (!$this->getClient()) {
         /** @var S3Client $name */
         $name = static::$s3ClientClass;
         $this->setClient($name::factory());
     }
     if ($this->config->isCaching() && !static::$cache) {
         static::attachCache(new DoctrineCacheAdapter(new ChainCache([new ArrayCache(), new Cache()])), $this->config->getCacheLifetime());
     }
 }