Download the PHP package minehub/prerequisites without Composer
On this page you can find all versions of the php package minehub/prerequisites. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download minehub/prerequisites
More information about minehub/prerequisites
Files in minehub/prerequisites
Package prerequisites
Short Description Library for evaluating prerequisities
License MIT
Informations about the package prerequisites
Prerequisities
Library for evaluating prerequisites writen in simple infix language.
Documentation
About
This library evaluates simple c-like logical expressions with given variables. It was made for MineHub academys prerequisites.
Syntax
As previously mentioned, it uses c-like logical expression syntax.
Variables
Variable names can contain every character except those: ()|&!
- these are reserved for other syntax. Variables can be only boolean and will be loaded from eval function. See evaluation
In examples we would use true and false to make it simpler, but you can use any variable name you want, as long as it doesn't contain reserved words.
Operators
You can use operators or (||
) with and (&&
), where and has bigger priority, meaning that
would evaluate as true
, instead of false
.
Groups
To change priority, you can use groups (just put it in brackets). So this
would evaluate as false
Negation
We can also negate variables and groups:
would evaluate as false
, and
would also evaluate as false
.
Everything is expression!
Everything is expression, so you can do stuff like:
Formal definition
TODO maybe its not correct
Evaluation
To evaluate string, simply create instance of \MineHub\Prerequisities\Evaluator
and use eval
method. This method takes code and array of variables: