Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Janis
/
btflags
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
058c30e1
authored
2018-09-28 10:13:08 +0800
by
Joshua Tundag
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix
1 parent
9df6640a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
src/BTFlags/FlagManager.php
tests/FlagsTest.php
src/BTFlags/FlagManager.php
View file @
058c30e
...
...
@@ -193,7 +193,7 @@ class FlagManager {
$flags
=
$this
->
all
();
if
(
!
$flags
)
return
[];
$filteredFlags
=
array_values
(
array_filter
(
$flags
,
function
(
$f
)
use
(
$flag
,
$encrypted
){
if
(
$f
[
'both_usable'
])
return
$f
[
'encrypted_name'
]
==
$flag
||
$f
[
'name'
]
==
$flag
;
if
(
isset
(
$f
[
'both_usable'
])
&&
$f
[
'both_usable'
])
return
$f
[
'encrypted_name'
]
==
$flag
||
$f
[
'name'
]
==
$flag
;
return
((
$encrypted
&&
$f
[
'encrypted_name'
]
==
$flag
)
||
(
!
$encrypted
&&
$f
[
'name'
])
==
$flag
);
}));
return
count
(
$filteredFlags
)
?
$filteredFlags
[
0
]
:
null
;
...
...
tests/FlagsTest.php
View file @
058c30e
...
...
@@ -35,7 +35,7 @@ final class FlagsTest extends TestCase
$flags
=
$this
->
flags
;
if
(
!
$flags
)
return
[];
$filteredFlags
=
array_values
(
array_filter
(
$flags
,
function
(
$f
)
use
(
$flag
,
$encrypted
){
if
(
$f
[
'both_usable'
])
return
$f
[
'encrypted_name'
]
==
$flag
||
$f
[
'name'
]
==
$flag
;
if
(
isset
(
$f
[
'both_usable'
])
&&
$f
[
'both_usable'
])
return
$f
[
'encrypted_name'
]
==
$flag
||
$f
[
'name'
]
==
$flag
;
return
((
$encrypted
&&
$f
[
'encrypted_name'
]
==
$flag
)
||
(
!
$encrypted
&&
$f
[
'name'
])
==
$flag
);
}));
$foundFlag
=
count
(
$filteredFlags
)
?
$filteredFlags
[
0
]
:
null
;
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment