本文整理匯總了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);
}
}