File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,25 @@ it is called with the file as a :class:`Symfony\\Component\\Finder\\SplFileInfo`
242
242
instance. The file is excluded from the result set if the Closure returns
243
243
``false ``.
244
244
245
+ Reading contents of returned files
246
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247
+
248
+ .. versionadded :: 2.1
249
+ Method ``getContents() `` have been introduced in version 2.1.
250
+
251
+ The contents of returned files can be read with
252
+ :method: `Symfony\\ Component\\ Finder\\ SplFileInfo::getContents `::
253
+
254
+ use Symfony\Component\Finder\Finder;
255
+
256
+ $finder = new Finder();
257
+ $finder->files()->in(__DIR__);
258
+
259
+ foreach ($finder as $file) {
260
+ $contents = $file->getContents();
261
+ ...
262
+ }
263
+
245
264
.. _strtotime : http://www.php.net/manual/en/datetime.formats.php
246
265
.. _Iterator : http://www.php.net/manual/en/spl.iterators.php
247
266
.. _protocol : http://www.php.net/manual/en/wrappers.php
You can’t perform that action at this time.
0 commit comments