Skip to content
Browse files

[Finder] added a convenience method Finder::create()

  • Loading branch information...
1 parent 86aa3d7 commit 83d148b10f3acf2a1d1cc427386a1d3d1a125206 @fabpot fabpot committed
Showing with 16 additions and 2 deletions.
  1. +16 −2 Finder.php
View
18 Finder.php
@@ -20,8 +20,7 @@
*
* All methods return the current Finder object to allow easy chaining:
*
- * $finder = new Finder();
- * $finder = $finder->files()->name('*.php')->in(__DIR__);
+ * $finder = Finder::create()->files()->name('*.php')->in(__DIR__);
*
* @author Fabien Potencier <fabien@symfony.com>
*
@@ -48,12 +47,27 @@ class Finder implements \IteratorAggregate
static private $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
+ /**
+ * Constructor.
+ */
public function __construct()
{
$this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
}
/**
+ * Creates a new Finder.
+ *
+ * @return Finder A new Finder instance
+ *
+ * @api
+ */
+ static public function create()
+ {
+ return new self();
+ }
+
+ /**
* Restricts the matching to directories only.
*
* @return Finder The current Finder instance

0 comments on commit 83d148b

Please sign in to comment.
Something went wrong with that request. Please try again.