Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 752ec05

Browse files
committed
Merge pull request #1527 from gajdaw/component_finder_path
[Component][Finder] path(), notPath() methods
2 parents d505335 + f8edb9f commit 752ec05

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

components/finder.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,34 @@ The ``notContains()`` method excludes files containing given pattern::
178178

179179
$finder->files()->notContains('dolor sit amet');
180180

181+
Path
182+
~~~~
183+
184+
.. versionadded:: 2.2
185+
Methods ``path()`` and ``notPath()`` have been
186+
introduced in version 2.2.
187+
188+
Restrict files and directories by path with the
189+
:method:`Symfony\\Component\\Finder\\Finder::path` method::
190+
191+
$finder->path('some/special/dir');
192+
193+
On all platforms slash (i.e. ``/``) should be used as a separator.
194+
195+
The ``path()`` method accepts strings or regexes::
196+
197+
$finder->path('foo/bar');
198+
$finder->path('/^foo\/bar/');
199+
200+
Strings are converted into regexes by escaping slashes and adding delimiters:
201+
202+
dirname ===> /dirname/
203+
a/b/c ===> /a\/b\/c/
204+
205+
The ``notPath()`` method excludes files by path::
206+
207+
$finder->notPath('other/dir');
208+
181209
File Size
182210
~~~~~~~~~
183211

0 commit comments

Comments
 (0)