Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getMetadata($key)
 {
     if ($this->source instanceof MetadataSupporter) {
         return $this->source->getMetadata($key);
     }
     return false;
 }
 /**
  * Write content to the primary adapter from the fallback
  */
 protected function writeContentToPrimary($key, $contents)
 {
     $this->primary->write($key, $contents);
     if ($this->primary instanceof Adapter\MetadataSupporter && $this->fallback instanceof Adapter\MetadataSupporter) {
         $this->primary->setMetadata($key, $this->fallback->getMetadata($key));
     }
 }
Example #3
0
 /**
  * @param \Gaufrette\Adapter $source
  * @param \Gaufrette\Adapter $cache
  */
 function it_should_ignore_metadata_when_cached_adapters_does_not_support_metadata($source, $cache)
 {
     $source->setMetadata('filename', array('metadata'))->shouldNotBeCalled();
     $cache->setMetadata('filename', array('metadata'))->shouldNotBeCalled();
     $source->getMetadata('filename')->shouldNotBeCalled();
     $this->setMetadata('filename', array('metadata'));
     $this->getMetadata('filename')->shouldReturn(false);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function getMetadata($key)
 {
     if ($this->master instanceof MetadataSupporter) {
         return $this->master->getMetadata($key);
     } elseif ($this->slave instanceof MetadataSupporter) {
         return $this->slave->getMetadata($key);
     }
     return array();
 }
 /**
  * @param \Gaufrette\Adapter $adapter
  */
 function it_should_not_delegate_metadata_when_delegate_object_does_not_support_it($adapter)
 {
     $adapter->setMetadata('filename', array('some'))->shouldNotBeCalled();
     $adapter->getMetadata('filename')->shouldNotBeCalled();
     $this->setMetadata('filename', array('some'));
     $this->getMetadata('filename')->shouldReturn(array());
 }