本文整理汇总了PHP中Finder::files方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::files方法的具体用法?PHP Finder::files怎么用?PHP Finder::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Finder
的用法示例。
在下文中一共展示了Finder::files方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testClearCache
public function testClearCache()
{
$dir = Renderer::getCacheDir();
Renderer::clearCache();
$finder = new Finder();
$finder->files()->name('*.php')->in($dir);
$this->assertEquals(0, $finder->count());
}
示例2: collectGarbage
/**
* Randomly runs garbage collection on the image directory
*
* @return bool
*/
public function collectGarbage()
{
if (!mt_rand(1, $this->gcFreq) == 1) {
return false;
}
$this->createFolderIfMissing();
$finder = new Finder();
$criteria = sprintf('<= now - %s minutes', $this->expiration);
$finder->in($this->webPath . '/' . $this->imageFolder)->date($criteria);
foreach ($finder->files() as $file) {
unlink($file->getPathname());
}
return true;
}
示例3: parseCSV
private function parseCSV()
{
$ignoreFirstLine = $this->csvParsingOptions['ignoreFirstLine'];
$finder = new Finder();
$finder->files()->in($this->csvParsingOptions['finder_in'])->name($this->csvParsingOptions['finder_name']);
foreach ($finder as $file) {
$csv = $file;
}
$rows = array();
if (($handle = fopen($csv->getRealPath(), "r")) !== FALSE) {
$i = 0;
while (($data = fgetcsv($handle, null, ";")) !== FALSE) {
$i++;
if ($ignoreFirstLine && $i == 1) {
continue;
}
$rows[] = $data;
}
fclose($handle);
}
return $rows;
}
示例4: test_copy
public function test_copy()
{
$finder = new Finder('tests/test-data/bigtree');
$finder->files()->named('#\\.json#')->copyTo('tests/test-data-copy');
}