From 6a84bfffbafcaa7998aae7f63f2d0d942756ee4d Mon Sep 17 00:00:00 2001
From: John Was <janek.jan@gmail.com>
Date: Mon, 20 Jan 2014 12:27:53 +0100
Subject: [PATCH] refactored flag names

---
 framework/helpers/BaseFileHelper.php | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php
index d540acc..88e4169 100644
--- a/framework/helpers/BaseFileHelper.php
+++ b/framework/helpers/BaseFileHelper.php
@@ -23,10 +23,10 @@ use yii\base\InvalidParamException;
  */
 class BaseFileHelper
 {
-	const EXC_FLAG_NODIR = 1;
-	const EXC_FLAG_ENDSWITH = 4;
-	const EXC_FLAG_MUSTBEDIR = 8;
-	const EXC_FLAG_NEGATIVE = 16;
+	const PATTERN_FLAG_NODIR = 1;
+	const PATTERN_FLAG_ENDSWITH = 4;
+	const PATTERN_FLAG_MUSTBEDIR = 8;
+	const PATTERN_FLAG_NEGATIVE = 16;
 
 	/**
 	 * Normalizes a file/directory path.
@@ -318,13 +318,13 @@ class BaseFileHelper
 
 		if (!empty($options['except'])) {
 			if (($except=self::lastExcludeMatchingFromList($options['basePath'], $path, $options['except'])) !== null) {
-				return $except['flags'] & self::EXC_FLAG_NEGATIVE;
+				return $except['flags'] & self::PATTERN_FLAG_NEGATIVE;
 			}
 		}
 
 		if (!is_dir($path) && !empty($options['only'])) {
 			if (($except=self::lastExcludeMatchingFromList($options['basePath'], $path, $options['only'])) !== null) {
-				// don't check EXC_FLAG_NEGATIVE since those entries are not prefixed with !
+				// don't check PATTERN_FLAG_NEGATIVE since those entries are not prefixed with !
 				return true;
 			}
 			return false;
@@ -375,7 +375,7 @@ class BaseFileHelper
 			if ($pattern === $baseName) {
 				return true;
 			}
-		} else if ($flags & self::EXC_FLAG_ENDSWITH) {
+		} else if ($flags & self::PATTERN_FLAG_ENDSWITH) {
 			/* "*literal" matching against "fooliteral" */
 			$n = StringHelper::byteLength($pattern);
 			if (StringHelper::byteSubstr($pattern, 1, $n) === StringHelper::byteSubstr($baseName, -$n, $n)) {
@@ -457,11 +457,11 @@ class BaseFileHelper
 			if (!isset($exclude['pattern']) || !isset($exclude['flags']) || !isset($exclude['firstWildcard'])) {
 				throw new InvalidParamException('If exclude/include pattern is an array it must contain the pattern, flags and firstWildcard keys.');
 			}
-			if ($exclude['flags'] & self::EXC_FLAG_MUSTBEDIR && !is_dir($path)) {
+			if ($exclude['flags'] & self::PATTERN_FLAG_MUSTBEDIR && !is_dir($path)) {
 				continue;
 			}
 
-			if ($exclude['flags'] & self::EXC_FLAG_NODIR) {
+			if ($exclude['flags'] & self::PATTERN_FLAG_NODIR) {
 				if (self::matchBasename(basename($path), $exclude['pattern'], $exclude['firstWildcard'], $exclude['flags'])) {
 					return $exclude;
 				}
@@ -495,20 +495,20 @@ class BaseFileHelper
 			return $result;
 
 		if ($pattern[0] == '!') {
-			$result['flags'] |= self::EXC_FLAG_NEGATIVE;
+			$result['flags'] |= self::PATTERN_FLAG_NEGATIVE;
 			$pattern = StringHelper::byteSubstr($pattern, 1, StringHelper::byteLength($pattern));
 		}
 		$len = StringHelper::byteLength($pattern);
 		if ($len && StringHelper::byteSubstr($pattern, -1, 1) == '/') {
 			$pattern = StringHelper::byteSubstr($pattern, 0, -1);
 			$len--;
-			$result['flags'] |= self::EXC_FLAG_MUSTBEDIR;
+			$result['flags'] |= self::PATTERN_FLAG_MUSTBEDIR;
 		}
 		if (strpos($pattern, '/') === false)
-			$result['flags'] |= self::EXC_FLAG_NODIR;
+			$result['flags'] |= self::PATTERN_FLAG_NODIR;
 		$result['firstWildcard'] = self::firstWildcardInPattern($pattern);
 		if ($pattern[0] == '*' && self::firstWildcardInPattern(StringHelper::byteSubstr($pattern, 1, StringHelper::byteLength($pattern))) === false)
-			$result['flags'] |= self::EXC_FLAG_ENDSWITH;
+			$result['flags'] |= self::PATTERN_FLAG_ENDSWITH;
 		$result['pattern'] = $pattern;
 		return $result;
 	}
--
libgit2 0.27.1