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

Skip to content

Commit 5fc01f2

Browse files
committed
[Finder] Changed method name for gnu find adapter.
1 parent 46cc2d4 commit 5fc01f2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Symfony/Component/Finder/Adapter/GnuFindAdapter.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ public function searchInDirectory($dir)
7878
$find->add('-type f');
7979
}
8080

81-
$this->buildNamesCommand($find, $this->names);
82-
$this->buildNamesCommand($find, $this->notNames, true);
83-
$this->buildSizesCommand($find, $this->sizes);
84-
$this->buildDatesCommand($find, $this->dates);
81+
$this->buildNamesFiltering($find, $this->names);
82+
$this->buildNamesFiltering($find, $this->notNames, true);
83+
$this->buildSizesFiltering($find, $this->sizes);
84+
$this->buildDatesFiltering($find, $this->dates);
8585

8686
$useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
8787
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('awk');
8888

8989
if ($useGrep && ($this->contains || $this->notContains)) {
9090
$grep = $command->ins('grep');
91-
$this->buildContainsCommand($grep, $this->contains);
92-
$this->buildContainsCommand($grep, $this->notContains, true);
91+
$this->buildContentFiltering($grep, $this->contains);
92+
$this->buildContentFiltering($grep, $this->notContains, true);
9393
}
9494

9595
if ($useSort) {
96-
$this->buildSortCommand($command, $this->sort);
96+
$this->buildSorting($command, $this->sort);
9797
}
9898

9999
$paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
@@ -141,7 +141,7 @@ public function getName()
141141
* @param string[] $names
142142
* @param bool $not
143143
*/
144-
private function buildNamesCommand(Command $command, array $names, $not = false)
144+
private function buildNamesFiltering(Command $command, array $names, $not = false)
145145
{
146146
if (0 === count($names)) {
147147
return;
@@ -178,7 +178,7 @@ private function buildNamesCommand(Command $command, array $names, $not = false)
178178
* @param Command $command
179179
* @param NumberComparator[] $sizes
180180
*/
181-
private function buildSizesCommand(Command $command, array $sizes)
181+
private function buildSizesFiltering(Command $command, array $sizes)
182182
{
183183
foreach ($sizes as $i => $size) {
184184
$command->add($i > 0 ? '-and' : null);
@@ -217,7 +217,7 @@ private function buildSizesCommand(Command $command, array $sizes)
217217
* @param Command $command
218218
* @param DateComparator[] $dates
219219
*/
220-
private function buildDatesCommand(Command $command, array $dates)
220+
private function buildDatesFiltering(Command $command, array $dates)
221221
{
222222
foreach ($dates as $i => $date) {
223223
$command->add($i > 0 ? '-and' : null);
@@ -265,11 +265,12 @@ private function buildDatesCommand(Command $command, array $dates)
265265
* @param array $contains
266266
* @param bool $not
267267
*/
268-
private function buildContainsCommand(Command $command, array $contains, $not = false)
268+
private function buildContentFiltering(Command $command, array $contains, $not = false)
269269
{
270270
foreach ($contains as $contain) {
271271
$expr = Expression::create($contain);
272272

273+
// todo: avoid forking process for each $pattern by using multiple -e options
273274
$command
274275
->add('| xargs -r grep -I')
275276
->add($expr->isCaseSensitive() ? null : '-i')
@@ -278,7 +279,7 @@ private function buildContainsCommand(Command $command, array $contains, $not =
278279
}
279280
}
280281

281-
private function buildSortCommand(Command $command, $sort)
282+
private function buildSorting(Command $command, $sort)
282283
{
283284
switch ($sort) {
284285
case SortableIterator::SORT_BY_NAME:

0 commit comments

Comments
 (0)