public function current() { $file = parent::current(); if ($file instanceof SplFileInfo) { // Wrap into sfFilebasePluginFile to provide additional methods // for analyzing file-type $file = new sfFilebasePluginFile($file, $this->filebase); if ($file->isDir()) { $file = new sfFilebasePluginDirectory($file, $this->filebase); } elseif ($file->isImage()) { $file = new sfFilebasePluginImage($file, $this->filebase); } } return $file; }