@@ -168,17 +168,22 @@ Sort the result by name or by type (directories first, then files)::
168
168
169
169
$finder->sortByType();
170
170
171
- .. note ::
171
+ .. tip ::
172
172
173
- Notice that the `` sort* `` methods need to get all matching elements to do
174
- their jobs. For large iterators, it is slow .
173
+ To sort by name using ` natural sort order `_ algorithm,
174
+ pass `` true `` as the first argument of `` sortByName() `` method .
175
175
176
176
You can also define your own sorting algorithm with ``sort() `` method::
177
177
178
178
$finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) {
179
179
return strcmp($a->getRealPath(), $b->getRealPath());
180
180
});
181
181
182
+ .. note ::
183
+
184
+ Notice that the ``sort* `` methods need to get all matching elements to do
185
+ their jobs. For large iterators, it is slow.
186
+
182
187
File Name
183
188
~~~~~~~~~
184
189
@@ -320,8 +325,9 @@ The contents of returned files can be read with
320
325
// ...
321
326
}
322
327
323
- .. _strtotime : https://php.net/manual/en/datetime.formats.php
324
- .. _protocol : https://php.net/manual/en/wrappers.php
325
- .. _Streams : https://php.net/streams
326
- .. _IEC standard : https://physics.nist.gov/cuu/Units/binary.html
327
- .. _Packagist : https://packagist.org/packages/symfony/finder
328
+ .. _strtotime : https://php.net/manual/en/datetime.formats.php
329
+ .. _protocol : https://php.net/manual/en/wrappers.php
330
+ .. _Streams : https://php.net/streams
331
+ .. _IEC standard : https://physics.nist.gov/cuu/Units/binary.html
332
+ .. _Packagist : https://packagist.org/packages/symfony/finder
333
+ .. _`natural sort order` : https://en.wikipedia.org/wiki/Natural_sort_order
0 commit comments