Skip to content

Commit

Permalink
TASK: Better naming for include and exclude paths/patterns
Browse files Browse the repository at this point in the history
Should have been named like this from the start. I'm to blame.
  • Loading branch information
albe authored Apr 19, 2019
1 parent 949b5c1 commit f88c6bf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Classes/I18n/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ public function findBestMatchingLocale(Locale $locale)

/**
* Returns a regex pattern including enclosing characters, that matches any of the configured
* blacklist paths inside "Neos.Flow.i18n.scan.excludePatterns".
* exclude list configured inside "Neos.Flow.i18n.scan.excludePatterns".
*
* @return string The regex pattern matching the configured blacklist
* @return string The regex pattern matching the configured exclude list
*/
protected function getScanBlacklistPattern()
protected function getScanExcludePattern()
{
$pattern = implode('|', array_keys(array_filter((array)$this->settings['scan']['excludePatterns'])));
if ($pattern !== '') {
Expand Down Expand Up @@ -286,11 +286,11 @@ protected function getScanBlacklistPattern()
*/
protected function generateAvailableLocalesCollectionByScanningFilesystem()
{
$whitelistPaths = array_keys(array_filter((array)$this->settings['scan']['includePaths']));
if ($whitelistPaths === []) {
$includePaths = array_keys(array_filter((array)$this->settings['scan']['includePaths']));
if ($includePaths === []) {
return;
}
$blacklistPattern = $this->getScanBlacklistPattern();
$excludePattern = $this->getScanExcludePattern();

/** @var PackageInterface $activePackage */
foreach ($this->packageManager->getActivePackages() as $activePackage) {
Expand All @@ -301,7 +301,7 @@ protected function generateAvailableLocalesCollectionByScanningFilesystem()
}

$directories = [];
foreach ($whitelistPaths as $path) {
foreach ($includePaths as $path) {
$scanPath = Files::concatenatePaths(array($packageResourcesPath, $path));
if (is_dir($scanPath)) {
array_push($directories, Files::getNormalizedPath($scanPath));
Expand All @@ -311,7 +311,7 @@ protected function generateAvailableLocalesCollectionByScanningFilesystem()
while ($directories !== []) {
$currentDirectory = array_pop($directories);
$relativeDirectory = '/' . str_replace($packageResourcesPath, '', $currentDirectory);
if ($blacklistPattern !== '' && preg_match($blacklistPattern, $relativeDirectory) === 1) {
if ($excludePattern !== '' && preg_match($excludePattern, $relativeDirectory) === 1) {
continue;
}

Expand Down

0 comments on commit f88c6bf

Please sign in to comment.