コード例 #1
0
ファイル: RendererTest.php プロジェクト: a11enwong/pochika
 public function testClearCache()
 {
     $dir = Renderer::getCacheDir();
     Renderer::clearCache();
     $finder = new Finder();
     $finder->files()->name('*.php')->in($dir);
     $this->assertEquals(0, $finder->count());
 }
コード例 #2
0
ファイル: ImageFileHandler.php プロジェクト: ivytin/re_web
 /**
  * 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
0
 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
0
 public function test_copy()
 {
     $finder = new Finder('tests/test-data/bigtree');
     $finder->files()->named('#\\.json#')->copyTo('tests/test-data-copy');
 }