2017 © Pedro Peláez
 

library boolean-evaluator

Build boolean expressions and apply them to stuff

image

nkonovski/boolean-evaluator

Build boolean expressions and apply them to stuff

  • Tuesday, April 3, 2018
  • by nkonovski
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Boolean Evaluator

Software License, (*1)

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., (*2)

Install

Via Composer, (*3)

``` bash $ composer require davidrjonas/boolean-evaluator, (*4)


Usage ----- ```php <?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., (*5)

The Versions

03/04 2018

dev-master

9999999-dev

Build boolean expressions and apply them to stuff

  Sources   Download

MIT