Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
f90e594f
Commit
f90e594f
authored
Jan 26, 2014
by
John Was
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove _FLAG from PATTERN_FLAG constants
parent
b2b10d16
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
BaseFileHelper.php
framework/helpers/BaseFileHelper.php
+13
-13
No files found.
framework/helpers/BaseFileHelper.php
View file @
f90e594f
...
...
@@ -23,10 +23,10 @@ use yii\base\InvalidParamException;
*/
class
BaseFileHelper
{
const
PATTERN_
FLAG_
NODIR
=
1
;
const
PATTERN_
FLAG_
ENDSWITH
=
4
;
const
PATTERN_
FLAG_
MUSTBEDIR
=
8
;
const
PATTERN_
FLAG_
NEGATIVE
=
16
;
const
PATTERN_NODIR
=
1
;
const
PATTERN_ENDSWITH
=
4
;
const
PATTERN_MUSTBEDIR
=
8
;
const
PATTERN_NEGATIVE
=
16
;
/**
* Normalizes a file/directory path.
...
...
@@ -319,13 +319,13 @@ class BaseFileHelper
if
(
!
empty
(
$options
[
'except'
]))
{
if
((
$except
=
self
::
lastExcludeMatchingFromList
(
$options
[
'basePath'
],
$path
,
$options
[
'except'
]))
!==
null
)
{
return
$except
[
'flags'
]
&
self
::
PATTERN_
FLAG_
NEGATIVE
;
return
$except
[
'flags'
]
&
self
::
PATTERN_NEGATIVE
;
}
}
if
(
!
is_dir
(
$path
)
&&
!
empty
(
$options
[
'only'
]))
{
if
((
$except
=
self
::
lastExcludeMatchingFromList
(
$options
[
'basePath'
],
$path
,
$options
[
'only'
]))
!==
null
)
{
// don't check PATTERN_
FLAG_
NEGATIVE since those entries are not prefixed with !
// don't check PATTERN_NEGATIVE since those entries are not prefixed with !
return
true
;
}
return
false
;
...
...
@@ -376,7 +376,7 @@ class BaseFileHelper
if
(
$pattern
===
$baseName
)
{
return
true
;
}
}
else
if
(
$flags
&
self
::
PATTERN_
FLAG_
ENDSWITH
)
{
}
else
if
(
$flags
&
self
::
PATTERN_ENDSWITH
)
{
/* "*literal" matching against "fooliteral" */
$n
=
StringHelper
::
byteLength
(
$pattern
);
if
(
StringHelper
::
byteSubstr
(
$pattern
,
1
,
$n
)
===
StringHelper
::
byteSubstr
(
$baseName
,
-
$n
,
$n
))
{
...
...
@@ -458,11 +458,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
::
PATTERN_
FLAG_
MUSTBEDIR
&&
!
is_dir
(
$path
))
{
if
(
$exclude
[
'flags'
]
&
self
::
PATTERN_MUSTBEDIR
&&
!
is_dir
(
$path
))
{
continue
;
}
if
(
$exclude
[
'flags'
]
&
self
::
PATTERN_
FLAG_
NODIR
)
{
if
(
$exclude
[
'flags'
]
&
self
::
PATTERN_NODIR
)
{
if
(
self
::
matchBasename
(
basename
(
$path
),
$exclude
[
'pattern'
],
$exclude
[
'firstWildcard'
],
$exclude
[
'flags'
]))
{
return
$exclude
;
}
...
...
@@ -496,20 +496,20 @@ class BaseFileHelper
return
$result
;
if
(
$pattern
[
0
]
==
'!'
)
{
$result
[
'flags'
]
|=
self
::
PATTERN_
FLAG_
NEGATIVE
;
$result
[
'flags'
]
|=
self
::
PATTERN_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
::
PATTERN_
FLAG_
MUSTBEDIR
;
$result
[
'flags'
]
|=
self
::
PATTERN_MUSTBEDIR
;
}
if
(
strpos
(
$pattern
,
'/'
)
===
false
)
$result
[
'flags'
]
|=
self
::
PATTERN_
FLAG_
NODIR
;
$result
[
'flags'
]
|=
self
::
PATTERN_NODIR
;
$result
[
'firstWildcard'
]
=
self
::
firstWildcardInPattern
(
$pattern
);
if
(
$pattern
[
0
]
==
'*'
&&
self
::
firstWildcardInPattern
(
StringHelper
::
byteSubstr
(
$pattern
,
1
,
StringHelper
::
byteLength
(
$pattern
)))
===
false
)
$result
[
'flags'
]
|=
self
::
PATTERN_
FLAG_
ENDSWITH
;
$result
[
'flags'
]
|=
self
::
PATTERN_ENDSWITH
;
$result
[
'pattern'
]
=
$pattern
;
return
$result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment