File tree 4 files changed +17
-11
lines changed
4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 53
53
run : composer update --prefer-dist --no-interaction
54
54
55
55
- name : Run phpcs
56
- run : phpcs -- -v
56
+ run : composer cs
57
57
58
58
- name : Execute tests
59
59
run : composer test -- --coverage-clover=coverage.xml
Original file line number Diff line number Diff line change @@ -22,14 +22,11 @@ include:
22
22
23
23
Examples of unacceptable behavior by participants include:
24
24
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
27
26
* Trolling, insulting/derogatory comments, and personal or political attacks
28
27
* Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
28
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
29
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
33
30
34
31
## Our Responsibilities
35
32
Original file line number Diff line number Diff line change 2
2
"name" : " softcreatr/jsonpath" ,
3
3
"description" : " JSONPath implementation for parsing, searching and flattening arrays" ,
4
4
"license" : " MIT" ,
5
- "version" : " 0.9.0 " ,
5
+ "version" : " 0.9.1 " ,
6
6
"authors" : [
7
7
{
8
8
"name" : " Stephen Frank" ,
29
29
},
30
30
"require-dev" : {
31
31
"phpunit/phpunit" : " 10 - 12" ,
32
- "roave/security-advisories" : " dev-latest"
32
+ "friendsofphp/php-cs-fixer" : " ^3.58" ,
33
+ "squizlabs/php_codesniffer" : " ^3.10"
33
34
},
34
35
"replace" : {
35
36
"flow/jsonpath" : " *"
50
51
"preferred-install" : " dist"
51
52
},
52
53
"scripts" : {
53
- "test" : " phpunit"
54
+ "test" : " phpunit" ,
55
+ "cs" : " phpcs" ,
56
+ "cs-fix" : " php-cs-fixer fix --config=.php-cs-fixer.dist.php"
54
57
}
55
58
}
Original file line number Diff line number Diff line change 10
10
11
11
use Flow \JSONPath \AccessHelper ;
12
12
use Flow \JSONPath \JSONPath ;
13
+ use Flow \JSONPath \JSONPathException ;
13
14
use RuntimeException ;
14
15
15
16
class QueryMatchFilter extends AbstractFilter
@@ -19,6 +20,9 @@ class QueryMatchFilter extends AbstractFilter
19
20
(\s*(?<operator>==|=~|=|<>|!==|!=|>=|<=|>|<|in|!in|nin)\s*(?<comparisonValue>.+))?
20
21
' ;
21
22
23
+ /**
24
+ * @throws JSONPathException
25
+ */
22
26
public function filter ($ collection ): array
23
27
{
24
28
\preg_match ('/^ ' . static ::MATCH_QUERY_OPERATORS . '$/x ' , $ this ->token ->value , $ matches );
@@ -61,13 +65,15 @@ public function filter($collection): array
61
65
62
66
foreach ($ collection as $ value ) {
63
67
$ value1 = null ;
68
+
64
69
if (AccessHelper::keyExists ($ value , $ key , $ this ->magicIsAllowed )) {
65
70
$ value1 = AccessHelper::getValue ($ value , $ key , $ this ->magicIsAllowed );
66
71
} elseif (\str_contains ($ key , '. ' )) {
67
72
$ value1 = (new JSONPath ($ value ))->find ($ key )->getData ()[0 ] ?? '' ;
68
73
}
74
+
69
75
if ($ value1 ) {
70
- if ($ operator === null && $ value1 ) {
76
+ if ($ operator === null ) {
71
77
$ return [] = $ value ;
72
78
}
73
79
You can’t perform that action at this time.
0 commit comments