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