Skip to content

Commit bc0921c

Browse files
author
Jean Claveau
committed
Wip : basic architecture, repo structure and tested negation resolution
1 parent 9a9eb94 commit bc0921c

27 files changed

+1562
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
/.idea
3+
/tests_coverage
4+
/clover.xml
5+
/docs/phpdoc

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
php:
4+
- '5.4'
5+
- '5.5'
6+
- '5.6'
7+
- '7.0'
8+
- '7.1'
9+
- hhvm # on Trusty only
10+
- nightly
11+
12+
# Commands to be run before your environment runs.
13+
before_script:
14+
- composer self-update
15+
- composer update --no-interaction
16+
17+
# Commands you want to run that will verify your build.
18+
script: ./phpunit --coverage-clover=coverage.xml
19+
20+
after_success:
21+
- bash <(curl -s https://codecov.io/bash)

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
11
# php-custom-filter
22
This class provides a way to define complex filters freely and the tools to handle them easily
3+
4+
Basic rules that cannot be simplified
5+
+ =
6+
7+
+ >
8+
+ <
9+
10+
+ null
11+
+ !null
12+
13+
+ function (regex or custom function returning a bool)
14+
15+
Composite rules
16+
+ ||
17+
+ &&
18+
+ !
19+
20+
-----------------------------------
21+
Considering v a parameter, "a" and "b" two atomics rules, "A" and "B" two composite rules
22+
23+
24+
-----------------------------------
25+
Simplification
26+
+ ! to leafs, then remove !
27+
- ! (v > a) : v <= a : (v < a || a = v)
28+
- ! (v < a) : v >= a : (v > a || a = v)
29+
- ! ( ! a) : a
30+
- ! (v = a) : (v < a) || (v > a)
31+
- ! (B && A) : (!B && A) || (B && !A) || (!B && !A)
32+
- ! (B || A) : !B && !A
33+
34+
+ or to root
35+
- create a new trunk for every || rule by duplicating all its parents
36+
- combine rules
37+
- simplify the or root
38+
39+
+ combine same atomics rules to get one of each max
40+
- combine every atomic rule of the same kind
41+
42+
+ or to leafs
43+
44+
-----------------------------------
45+
Aliases
46+
+ between : < and >
47+
+ outside : > and <
48+
+ in : and (=, =, =) <=> in
49+
+ : > or <
50+
+

composer.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "jclaveau/php-custom-filter",
3+
"description": "A class to gather filter parameters into one object and handle them easily.",
4+
"license": "MIT",
5+
"keywords": ["filter", "custom", "rules", "object parameter"],
6+
"authors": [
7+
{
8+
"name": "Jean Claveau",
9+
"role": "Developer"
10+
}
11+
],
12+
"autoload": {
13+
"psr-4" : {
14+
"JClaveau\\CustomFilter\\" : "src"
15+
}
16+
},
17+
"repositories": [
18+
{
19+
"type": "vcs",
20+
"url": "https://github.com/jclaveau/php-visibility-violator",
21+
"no-api": true
22+
}
23+
],
24+
"require-dev": {
25+
"phpunit/phpunit": "5.*",
26+
"jclaveau/php-visibility-violator": "dev-master",
27+
"evert/phpdoc-md": "~0.2.0",
28+
"phpdocumentor/phpdocumentor": "~2.8.0"
29+
},
30+
"require": {
31+
"php": ">=5.4.0"
32+
}
33+
}

docs_generator

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# phpdoc command
2+
vendor/bin/phpdoc -d src -t docs/phpdoc --template="xml"
3+
4+
# Next, run phpdocmd:
5+
vendor/bin/phpdocmd docs/phpdoc/structure.xml docs

phpunit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor/bin/phpunit

phpunit.xml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<phpunit backupGlobals="false"
3+
defaultTestSuite="unit"
4+
backupStaticAttributes="true"
5+
colors="true">
6+
<!--
7+
bootstrap="./tests/bootstrap_phpunit.php"
8+
backupGlobals="false" is required to don't loose $link as link_identifier
9+
backupStaticAttributes="false"
10+
syntaxCheck="false"
11+
-->
12+
13+
<testsuites>
14+
<testsuite name="unit">
15+
<directory>./tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
20+
<filter>
21+
<!-- /!\ whitelist will exclude every outside class from coverage -->
22+
<whitelist>
23+
<directory suffix=".php">./src</directory>
24+
<directory suffix=".php">./tests</directory>
25+
</whitelist>
26+
<!--blacklist>
27+
<directory>./vendor</directory>
28+
<directory>./tests/coverage</directory>
29+
</blacklist-->
30+
</filter>
31+
32+
<logging>
33+
<log type="coverage-clover" target="clover.xml"/>
34+
<log type="coverage-html" target="tests_coverage/" charset="UTF-8" yui="true" />
35+
</logging>
36+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
namespace JClaveau\SocialVideo;
3+
4+
class NotImplementedException extends \BadMethodCallException
5+
{
6+
/**/
7+
}

0 commit comments

Comments
 (0)