From e3610e1949e6a9ebeec06c0295f7b1048b755272 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 30 Aug 2023 19:40:13 +0200 Subject: [PATCH] Rename includ/exclude parameters --- src/IterableCodeExtractor.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/IterableCodeExtractor.php b/src/IterableCodeExtractor.php index 1c6bf91..8611ca2 100644 --- a/src/IterableCodeExtractor.php +++ b/src/IterableCodeExtractor.php @@ -225,29 +225,29 @@ protected static function containsMatchingChildren( SplFileInfo $dir, array $mat * Recursively gets all PHP files within a directory. * * @param string $dir A path of a directory. - * @param array $include List of files and directories to include. - * @param array $exclude List of files and directories to skip. + * @param array $includes List of files and directories to include. + * @param array $excludes List of files and directories to skip. * @param array $extensions List of filename extensions to process. * * @return array File list. */ - public static function getFilesFromDirectory( $dir, array $include = [], array $exclude = [], $extensions = [] ) { + public static function getFilesFromDirectory( $dir, array $includes = [], array $excludes = [], $extensions = [] ) { $filtered_files = []; $files = new RecursiveIteratorIterator( new RecursiveCallbackFilterIterator( new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::UNIX_PATHS | RecursiveDirectoryIterator::FOLLOW_SYMLINKS ), - static function ( $file, $key, $iterator ) use ( $include, $exclude, $extensions ) { + static function ( $file, $key, $iterator ) use ( $includes, $excludes, $extensions ) { /** @var RecursiveCallbackFilterIterator $iterator */ /** @var SplFileInfo $file */ // Normalize include and exclude paths. - $include = array_map( self::class . '::trim_leading_slash', $include ); - $exclude = array_map( self::class . '::trim_leading_slash', $exclude ); + $includes = array_map( self::class . '::trim_leading_slash', $includes ); + $excludes = array_map( self::class . '::trim_leading_slash', $excludes ); - // If no $include is passed everything gets the weakest possible matching score. - $inclusion_score = empty( $include ) ? 0.1 : static::calculateMatchScore( $file, $include ); - $exclusion_score = static::calculateMatchScore( $file, $exclude ); + // If no $includes is passed everything gets the weakest possible matching score. + $inclusion_score = empty( $includes ) ? 0.1 : static::calculateMatchScore( $file, $includes ); + $exclusion_score = static::calculateMatchScore( $file, $excludes ); // Always include directories that aren't excluded. if ( 0 === $exclusion_score && $iterator->hasChildren() ) { @@ -256,7 +256,7 @@ static function ( $file, $key, $iterator ) use ( $include, $exclude, $extensions if ( ( 0 === $inclusion_score || $exclusion_score > $inclusion_score ) && $iterator->hasChildren() ) { // Always include directories that may have matching children even if they are excluded. - return static::containsMatchingChildren( $file, $include ); + return static::containsMatchingChildren( $file, $includes ); } // Include directories that are excluded but include score is higher.