src/Gregwar/Captcha/ImageFileHandler.php
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;
    }
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;
    }
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 ; }
Randomly runs garbage collection on the image directory

@return bool
Randomly runs garbage collection on the image directory