Symfony\Component\Finder\Finder::files PHP Method

files() public method

Restricts the matching to files only.
public files ( ) : Finder | Symfony\Component\Finder\SplFileInfo[]
return Finder | Symfony\Component\Finder\SplFileInfo[] The current Finder instance
    public function files()
    {
        $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;

        return $this;
    }

Usage Example

 public function tearDown()
 {
     // Delete local files
     $finder = new Finder();
     $fs = new Filesystem();
     $fs->remove($finder->files()->in($this->tmpDir . "/download"));
     $fs->remove($finder->files()->in($this->tmpDir));
     $fs->remove($this->tmpDir . "/download");
     $fs->remove($this->tmpDir);
     // Delete file uploads
     $options = new ListFilesOptions();
     $options->setTags(["docker-bundle-test"]);
     $files = $this->client->listFiles($options);
     foreach ($files as $file) {
         $this->client->deleteFile($file["id"]);
     }
     if ($this->client->bucketExists("in.c-docker-test")) {
         // Delete tables
         foreach ($this->client->listTables("in.c-docker-test") as $table) {
             $this->client->dropTable($table["id"]);
         }
         // Delete bucket
         $this->client->dropBucket("in.c-docker-test");
     }
     if ($this->client->bucketExists("in.c-docker-test-redshift")) {
         // Delete tables
         foreach ($this->client->listTables("in.c-docker-test-redshift") as $table) {
             $this->client->dropTable($table["id"]);
         }
         // Delete bucket
         $this->client->dropBucket("in.c-docker-test-redshift");
     }
 }
All Usage Examples Of Symfony\Component\Finder\Finder::files