comparison vendor/symfony/finder/Finder.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
27 * 27 *
28 * It is a thin wrapper around several specialized iterator classes. 28 * It is a thin wrapper around several specialized iterator classes.
29 * 29 *
30 * All rules may be invoked several times. 30 * All rules may be invoked several times.
31 * 31 *
32 * All methods return the current Finder object to allow easy chaining: 32 * All methods return the current Finder object to allow chaining:
33 * 33 *
34 * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); 34 * $finder = Finder::create()->files()->name('*.php')->in(__DIR__);
35 * 35 *
36 * @author Fabien Potencier <fabien@symfony.com> 36 * @author Fabien Potencier <fabien@symfony.com>
37 */ 37 */
643 * 643 *
644 * @return \Iterator 644 * @return \Iterator
645 */ 645 */
646 private function searchInDirectory($dir) 646 private function searchInDirectory($dir)
647 { 647 {
648 $exclude = $this->exclude;
649 $notPaths = $this->notPaths;
650
648 if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) { 651 if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
649 $this->exclude = array_merge($this->exclude, self::$vcsPatterns); 652 $exclude = array_merge($exclude, self::$vcsPatterns);
650 } 653 }
651 654
652 if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) { 655 if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
653 $this->notPaths[] = '#(^|/)\..+(/|$)#'; 656 $notPaths[] = '#(^|/)\..+(/|$)#';
654 } 657 }
655 658
656 $minDepth = 0; 659 $minDepth = 0;
657 $maxDepth = PHP_INT_MAX; 660 $maxDepth = PHP_INT_MAX;
658 661
681 $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS; 684 $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
682 } 685 }
683 686
684 $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs); 687 $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
685 688
686 if ($this->exclude) { 689 if ($exclude) {
687 $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude); 690 $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
688 } 691 }
689 692
690 $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); 693 $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
691 694
692 if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) { 695 if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
715 718
716 if ($this->filters) { 719 if ($this->filters) {
717 $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters); 720 $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
718 } 721 }
719 722
720 if ($this->paths || $this->notPaths) { 723 if ($this->paths || $notPaths) {
721 $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths); 724 $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
722 } 725 }
723 726
724 if ($this->sort) { 727 if ($this->sort) {
725 $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort); 728 $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
726 $iterator = $iteratorAggregate->getIterator(); 729 $iterator = $iteratorAggregate->getIterator();