/** * {@inheritDoc} */ public function keys() { $cacheFile = 'keys.cache'; if ($this->needsRebuild($cacheFile)) { $keys = $this->source->keys(); $this->serializeCache->write($cacheFile, serialize($keys)); } else { $keys = unserialize($this->serializeCache->read($cacheFile)); } return $keys; }
/** * {@inheritdoc} */ public function keys() { return $this->master->keys(); }
/** * @param \Gaufrette\Adapter $adapter */ function it_listing_directories_using_adapter_is_directory_method($adapter) { $keys = array('filename', 'filename1', 'filename2', 'testKey', 'KeyTest', 'testkey'); $adapter->keys()->willReturn($keys); $adapter->isDirectory('filename')->willReturn(false); $adapter->isDirectory('filename2')->willReturn(false); $adapter->isDirectory('KeyTest')->willReturn(false); $adapter->isDirectory('testkey')->willReturn(false); $adapter->isDirectory('filename1')->willReturn(true); $adapter->isDirectory('testKey')->willReturn(true); $this->listKeys()->shouldReturn(array('keys' => array('filename', 'filename2', 'KeyTest', 'testkey'), 'dirs' => array('filename1', 'testKey'))); $this->listKeys('filename')->shouldReturn(array('keys' => array('filename', 'filename2'), 'dirs' => array('filename1'))); $this->listKeys('Key')->shouldReturn(array('keys' => array('KeyTest'), 'dirs' => array())); }
/** * @param \Gaufrette\Adapter $adapter */ function it_delegates_keys($adapter) { $adapter->keys()->willReturn(array('filename', 'filename2')); $this->keys()->shouldReturn(array('filename', 'filename2')); }
/** * @param \Gaufrette\Adapter $source */ function it_should_get_keys_from_source($source) { $source->keys()->willReturn(array('filename2', 'filename1', 'filename')); $this->keys()->shouldReturn(array('filename', 'filename1', 'filename2')); }
/** * @param \Gaufrette\Adapter $adapter */ function it_should_decide_which_key_is_dir_using_adapter($adapter) { $keys = array('filename', 'filename1', 'filename2', 'testKey', 'KeyTest', 'testkey'); $adapter->keys()->willReturn($keys); $adapter->isDirectory('filename')->willReturn(false); $adapter->isDirectory('filename2')->willReturn(false); $adapter->isDirectory('KeyTest')->willReturn(false); $adapter->isDirectory('testkey')->willReturn(false); $adapter->isDirectory('filename1')->willReturn(true); $adapter->isDirectory('testKey')->willReturn(true); $this->listKeys()->shouldReturn(array('keys' => array('filename', 'filename2', 'KeyTest', 'testkey'), 'dirs' => array('filename1', 'testKey'))); $this->listKeys('filename')->shouldReturn(array('keys' => array('filename', 'filename2'), 'dirs' => array('filename1'))); $this->listKeys('Key')->shouldReturn(array('keys' => array('KeyTest'), 'dirs' => array('testKey'))); }
/** * {@inheritDoc} */ public function keys() { return array_merge($this->primary->keys(), $this->fallback->keys()); }