本文整理汇总了PHP中Gaufrette\Filesystem::keys方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::keys方法的具体用法?PHP Filesystem::keys怎么用?PHP Filesystem::keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaufrette\Filesystem
的用法示例。
在下文中一共展示了Filesystem::keys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCache
public function testCache()
{
$cacheAdapter = new InMemory(array());
$this->app['finder.cache.adapter'] = $cacheAdapter;
$cache = new Filesystem($cacheAdapter);
$this->assertEmpty($cache->keys());
// exec without cache
$this->runCommand('rollback', array('sourcePath' => 'src/'));
$this->assertEmpty($cache->keys());
// exec with cache
$this->runCommand('rollback', array('--cache' => true, 'sourcePath' => 'src/'));
$this->assertNotEmpty($cache->keys());
}
示例2: clearCache
/**
* {@inheritDoc}
*/
public function clearCache($maxAge)
{
$delTime = time() - (int) $maxAge;
$num = 0;
foreach ($this->temporaryFilesystem->keys() as $key) {
if (!$this->temporaryFilesystem->getAdapter()->isDirectory($key)) {
if ($delTime > $this->temporaryFilesystem->mtime($key)) {
$this->temporaryFilesystem->delete($key);
$num++;
}
}
}
return $num;
}
示例3: shouldWorkWithHiddenFiles
/**
* @test
* @group functional
*/
public function shouldWorkWithHiddenFiles()
{
$this->filesystem->write('.foo', 'hidden');
$this->assertTrue($this->filesystem->has('.foo'));
$this->assertContains('.foo', $this->filesystem->keys());
$this->filesystem->delete('.foo');
$this->assertFalse($this->filesystem->has('.foo'));
}
示例4: shouldFetchKeys
/**
* @test
* @group functional
*/
public function shouldFetchKeys()
{
$this->assertEquals(array(), $this->filesystem->keys());
$this->filesystem->write('foo', 'Some content');
$this->filesystem->write('bar', 'Some content');
$this->filesystem->write('baz', 'Some content');
$actualKeys = $this->filesystem->keys();
$this->assertEquals(3, count($actualKeys));
foreach (array('foo', 'bar', 'baz') as $key) {
$this->assertContains($key, $actualKeys);
}
}