Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/finder/Finder.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
295 } | 295 } |
296 | 296 |
297 /** | 297 /** |
298 * Excludes directories. | 298 * Excludes directories. |
299 * | 299 * |
300 * Directories passed as argument must be relative to the ones defined with the `in()` method. For example: | |
301 * | |
302 * $finder->in(__DIR__)->exclude('ruby'); | |
303 * | |
300 * @param string|array $dirs A directory path or an array of directories | 304 * @param string|array $dirs A directory path or an array of directories |
301 * | 305 * |
302 * @return $this | 306 * @return $this |
303 * | 307 * |
304 * @see ExcludeDirectoryFilterIterator | 308 * @see ExcludeDirectoryFilterIterator |
310 return $this; | 314 return $this; |
311 } | 315 } |
312 | 316 |
313 /** | 317 /** |
314 * Excludes "hidden" directories and files (starting with a dot). | 318 * Excludes "hidden" directories and files (starting with a dot). |
319 * | |
320 * This option is enabled by default. | |
315 * | 321 * |
316 * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not | 322 * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not |
317 * | 323 * |
318 * @return $this | 324 * @return $this |
319 * | 325 * |
331 } | 337 } |
332 | 338 |
333 /** | 339 /** |
334 * Forces the finder to ignore version control directories. | 340 * Forces the finder to ignore version control directories. |
335 * | 341 * |
342 * This option is enabled by default. | |
343 * | |
336 * @param bool $ignoreVCS Whether to exclude VCS files or not | 344 * @param bool $ignoreVCS Whether to exclude VCS files or not |
337 * | 345 * |
338 * @return $this | 346 * @return $this |
339 * | 347 * |
340 * @see ExcludeDirectoryFilterIterator | 348 * @see ExcludeDirectoryFilterIterator |
530 { | 538 { |
531 $resolvedDirs = array(); | 539 $resolvedDirs = array(); |
532 | 540 |
533 foreach ((array) $dirs as $dir) { | 541 foreach ((array) $dirs as $dir) { |
534 if (is_dir($dir)) { | 542 if (is_dir($dir)) { |
535 $resolvedDirs[] = $dir; | 543 $resolvedDirs[] = $this->normalizeDir($dir); |
536 } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { | 544 } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { |
537 $resolvedDirs = array_merge($resolvedDirs, $glob); | 545 $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob)); |
538 } else { | 546 } else { |
539 throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); | 547 throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); |
540 } | 548 } |
541 } | 549 } |
542 | 550 |
718 $iterator = $iteratorAggregate->getIterator(); | 726 $iterator = $iteratorAggregate->getIterator(); |
719 } | 727 } |
720 | 728 |
721 return $iterator; | 729 return $iterator; |
722 } | 730 } |
731 | |
732 /** | |
733 * Normalizes given directory names by removing trailing slashes. | |
734 * | |
735 * @param string $dir | |
736 * | |
737 * @return string | |
738 */ | |
739 private function normalizeDir($dir) | |
740 { | |
741 return rtrim($dir, '/'.\DIRECTORY_SEPARATOR); | |
742 } | |
723 } | 743 } |