4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Finder\Adapter;
14 @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
16 use Symfony\Component\Finder\Iterator;
19 * PHP finder engine implementation.
21 * @author Jean-François Simon <contact@jfsimon.fr>
23 * @deprecated since 2.8, to be removed in 3.0. Use Finder instead.
25 class PhpAdapter extends AbstractAdapter
30 public function searchInDirectory($dir)
32 $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
34 if ($this->followLinks) {
35 $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
38 $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
41 $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
44 $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
46 if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
47 $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
51 $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
54 if ($this->names || $this->notNames) {
55 $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
58 if ($this->contains || $this->notContains) {
59 $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
63 $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
67 $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
71 $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
74 if ($this->paths || $this->notPaths) {
75 $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
79 $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
80 $iterator = $iteratorAggregate->getIterator();
89 public function getName()
97 protected function canBeUsed()