nkonovski/boolean-evaluator
Composer 安装命令:
composer require nkonovski/boolean-evaluator
包简介
Build boolean expressions and apply them to stuff
README 文档
README
This is an experiment in PHP to build up an expression that can be evaluated in arbitrary ways. It wasn't meant for production, but if you're interested drop me a line and I'll start tagging releases.
Install
Via Composer
$ composer require davidrjonas/boolean-evaluator
Usage
<?php require __DIR__ . '/vendor/autoload.php'; use DavidRJonas\BooleanEvaluator as B; $expr = (new B\Expression) ->bAnd('A', 'B') ->bOr('C', 'D') ->bNot( (new B\Expression)->bAnd('C', 'D') ); print (new B\Evaluator\Stringer)->apply($expr); // output: A and B and (C or D) and not (C and D) $evaluator = new B\Evaluator\SetContains; var_dump($evaluator->apply($expr, ['A', 'B', 'C'])); // true var_dump($evaluator->apply($expr, ['A', 'B', 'D'])); // true var_dump($evaluator->apply($expr, ['A', 'B'])); // false, a C or D is missing var_dump($evaluator->apply($expr, ['A', 'B', 'C', 'D'])); // false, C or D but not both
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 20.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-03