File tree Expand file tree Collapse file tree 7 files changed +109
-7
lines changed Expand file tree Collapse file tree 7 files changed +109
-7
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,6 @@ end_of_line = lf
55insert_final_newline = true
66indent_style = space
77indent_size = 4
8+
9+ [* .yml,* .yaml ]
10+ indent_size = 2
Original file line number Diff line number Diff line change 1+ name : Lint PHP Source Code
2+
3+ on :
4+ push :
5+ branches :
6+ - ' **'
7+ pull_request :
8+ branches : [ master ]
9+
10+ jobs :
11+ build :
12+
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - uses : actions/checkout@v2
17+
18+ - name : Cache Composer packages
19+ id : composer-cache
20+ uses : actions/cache@v2
21+ with :
22+ path : vendor
23+ key : ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
24+ restore-keys : |
25+ ${{ runner.os }}-php-
26+
27+ - name : Install dependencies
28+ if : steps.composer-cache.outputs.cache-hit != 'true'
29+ run : composer install --prefer-dist --no-progress --no-suggest
30+
31+ - name : Run linter
32+ run : composer run-script lint
Original file line number Diff line number Diff line change 1+ name : Unit Test
2+
3+ on :
4+ push :
5+ branches :
6+ - ' **'
7+ pull_request :
8+ branches : [ master ]
9+
10+ jobs :
11+ build :
12+
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - uses : actions/checkout@v2
17+
18+ - name : Validate composer.json and composer.lock
19+ run : composer validate
20+
21+ - name : Cache Composer packages
22+ id : composer-cache
23+ uses : actions/cache@v2
24+ with :
25+ path : vendor
26+ key : ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27+ restore-keys : |
28+ ${{ runner.os }}-php-
29+
30+ - name : Install dependencies
31+ if : steps.composer-cache.outputs.cache-hit != 'true'
32+ run : composer install --prefer-dist --no-progress --no-suggest
33+
34+ - name : Run test suite
35+ run : composer run-script test:ci
36+
37+ - name : Archive coverage results
38+ uses : actions/upload-artifact@v2
39+ with :
40+ name : code-coverage-report
41+ path : cache/coverage
Original file line number Diff line number Diff line change 11# An unofficial PHP implementation of JsonLogic
2+
3+ ### Usage
4+
5+ - For an one-time logic to data use case, the ` apply ` function is enough:
6+
7+ ``` php
8+ echo \JsonLogic\JsonLogic::apply($rule, $data);
9+ ```
10+
11+ - For a rule runs tons times, e.g. find matched records in daily logs:
12+
13+ ```php
14+ $rule = \JsonLogic\JsonLogic::rule($rule);
15+
16+ var_dump(
17+ array_filter($logs, function ($log) use ($rule) {
18+ return $rule->process($log);
19+ })
20+ );
21+ ```
Original file line number Diff line number Diff line change 3333 },
3434 "scripts" : {
3535 "lint" : " phpcs" ,
36- "test" : " phpunit"
36+ "test" : " phpunit --stop-on-failure --no-coverage --colors=auto" ,
37+ "test:ci" : " phpunit --disallow-test-output -c phpunit.xml.dist"
3738 }
3839}
Original file line number Diff line number Diff line change 33 backupGlobals =" false"
44 backupStaticAttributes =" false"
55 bootstrap =" tests/bootstrap.php"
6- colors =" false"
7- convertErrorsToExceptions =" true"
8- convertNoticesToExceptions =" true"
9- convertWarningsToExceptions =" true"
10- processIsolation =" false"
11- stopOnFailure =" false"
126 cacheResultFile =" cache/.phpunit.result.cache"
7+ failOnRisky =" true"
8+ failOnWarning =" true"
139>
1410 <testsuites >
1511 <testsuite name =" Json Logic Test Suite" >
2117 <directory suffix =" .php" >./src/</directory >
2218 </whitelist >
2319 </filter >
20+ <logging >
21+ <log type =" coverage-html" target =" cache/coverage/report" lowUpperBound =" 35" highLowerBound =" 70" />
22+ <log type =" coverage-clover" target =" cache/coverage/coverage.xml" />
23+ <log type =" coverage-text" target =" php://stdout" showUncoveredFiles =" false" />
24+ <log type =" junit" target =" cache/coverage/junit.xml" />
25+ <log type =" testdox-text" target =" cache/coverage/testdox.txt" />
26+ </logging >
2427</phpunit >
Original file line number Diff line number Diff line change 1515
1616/**
1717 * For fully fallback to official JsonLogic lib
18+ *
19+ * phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1820 */
1921trait Fallbacks
2022{
You can’t perform that action at this time.
0 commit comments