* */ class NonEmptyFileIterator extends FilterIterator { /** * Accept non-empty files * * @return bool Whether the current element of the iterator is acceptable * through this filter */ public function accept() { $current = $this->current(); /** @var $current \SplFileInfo */ if (! $current->isFile() || $current->getSize() === 0 ) { return false; } return true; } }