Skip to content

Commit 272173a

Browse files
committed
0.9.1
1 parent a15deed commit 272173a

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

.github/workflows/Test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
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

CODE_OF_CONDUCT.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ include:
2222

2323
Examples 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

composer.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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",
@@ -29,7 +29,8 @@
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": "*"
@@ -50,6 +51,8 @@
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
}

src/Filters/QueryMatchFilter.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Flow\JSONPath\AccessHelper;
1212
use Flow\JSONPath\JSONPath;
13+
use Flow\JSONPath\JSONPathException;
1314
use RuntimeException;
1415

1516
class 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

0 commit comments

Comments
 (0)