File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 5353 run : composer update --prefer-dist --no-interaction
5454
5555 - name : Run phpcs
56- run : phpcs -- -v
56+ run : composer cs
5757
5858 - name : Execute tests
5959 run : composer test -- --coverage-clover=coverage.xml
Original file line number Diff line number Diff line change @@ -22,14 +22,11 @@ include:
2222
2323Examples of unacceptable behavior by participants include:
2424
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
2726* Trolling, insulting/derogatory comments, and personal or political attacks
2827* 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
3330
3431## Our Responsibilities
3532
Original file line number Diff line number Diff line change 22 "name" : " softcreatr/jsonpath" ,
33 "description" : " JSONPath implementation for parsing, searching and flattening arrays" ,
44 "license" : " MIT" ,
5- "version" : " 0.9.0 " ,
5+ "version" : " 0.9.1 " ,
66 "authors" : [
77 {
88 "name" : " Stephen Frank" ,
2929 },
3030 "require-dev" : {
3131 "phpunit/phpunit" : " 10 - 12" ,
32- "roave/security-advisories" : " dev-latest"
32+ "friendsofphp/php-cs-fixer" : " ^3.58" ,
33+ "squizlabs/php_codesniffer" : " ^3.10"
3334 },
3435 "replace" : {
3536 "flow/jsonpath" : " *"
5051 "preferred-install" : " dist"
5152 },
5253 "scripts" : {
53- "test" : " phpunit"
54+ "test" : " phpunit" ,
55+ "cs" : " phpcs" ,
56+ "cs-fix" : " php-cs-fixer fix --config=.php-cs-fixer.dist.php"
5457 }
5558}
Original file line number Diff line number Diff line change 1010
1111use Flow \JSONPath \AccessHelper ;
1212use Flow \JSONPath \JSONPath ;
13+ use Flow \JSONPath \JSONPathException ;
1314use RuntimeException ;
1415
1516class QueryMatchFilter extends AbstractFilter
@@ -19,6 +20,9 @@ class QueryMatchFilter extends AbstractFilter
1920 (\s*(?<operator>==|=~|=|<>|!==|!=|>=|<=|>|<|in|!in|nin)\s*(?<comparisonValue>.+))?
2021 ' ;
2122
23+ /**
24+ * @throws JSONPathException
25+ */
2226 public function filter ($ collection ): array
2327 {
2428 \preg_match ('/^ ' . static ::MATCH_QUERY_OPERATORS . '$/x ' , $ this ->token ->value , $ matches );
@@ -61,13 +65,15 @@ public function filter($collection): array
6165
6266 foreach ($ collection as $ value ) {
6367 $ value1 = null ;
68+
6469 if (AccessHelper::keyExists ($ value , $ key , $ this ->magicIsAllowed )) {
6570 $ value1 = AccessHelper::getValue ($ value , $ key , $ this ->magicIsAllowed );
6671 } elseif (\str_contains ($ key , '. ' )) {
6772 $ value1 = (new JSONPath ($ value ))->find ($ key )->getData ()[0 ] ?? '' ;
6873 }
74+
6975 if ($ value1 ) {
70- if ($ operator === null && $ value1 ) {
76+ if ($ operator === null ) {
7177 $ return [] = $ value ;
7278 }
7379
You can’t perform that action at this time.
0 commit comments