aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Calculator.php
Commit message (Collapse)AuthorAgeFilesLines
* Support unlimited args for min, max default funcs. (#106)Fatih Kızmaz2022-05-131-1/+1
| | | | | | | | | * Support unlimited args for min, max default funcs. Default functions max and min were requiring 2 arguments strictly. Now they supoort unlimited args, same as php's min, max funcs. * Improved functions: support unlimited parameters (see min, max funcs), optional parameters (see round func), parameters with types (see round func, throws IncorrectFunctionParameterException on unmatched type, union types and intersection types not supported because of min php level! there is a todo for this, to support them later @see CustomFunction@execute) Also added unittests for improvements. * Run php-cs-fixer fix
* Two more tests + some code refactoring (#104)Javier Marín2022-05-091-2/+13
| | | | | | | | | | | * test: add testNullReturnType and testUnsupportedOperands * refactor: fix PhpDoc comments and use PHP 7.4 arrow functions * refactor: fix PHP-CS-Fixer issues * test: run testUnsupportedOperands() only on PHP8+ Co-authored-by: Javier Marín <contacto@ideatic.net>
* Phpcs fixer (#103)Bruce Wells2022-04-271-25/+17
| | | | | | | * Configuring PHP CS Fixer Dropping PHP 7,3 support * Fixing merge issue
* PhpStan support, consts visibilty and name for tokens (#89)Javier Marín2021-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * Added handler to define not found variables Added support for string variables Fixed strings and ints comparison error * Check if variables have scalar types (int, float, string and bool) Better $onVarNotFound logic * Better support for null variables * Better support for null variables * Better support for null variables * Allow null values in `setVar` method * Support for unary positive operator * Add PhpStan config file Fix PhpStan warnings Set consts visibility Add name info to variable tokens for easier debugging Co-authored-by: Javier Marín <contacto@ideatic.net>
* Improved support for null variables (#72)V2.1.2Javier Marín2020-09-151-3/+1
| | | | | | | | | | | | | | * Added handler to define not found variables Added support for string variables Fixed strings and ints comparison error * Check if variables have scalar types (int, float, string and bool) Better $onVarNotFound logic * Better support for null variables * Better support for null variables * Better support for null variables
* Handler for not found variables (#68)Javier Marín2020-07-261-3/+11
| | | | | | | | * Added handler to define not found variables Added support for string variables Fixed strings and ints comparison error * Check if variables have scalar types (int, float, string and bool) Better $onVarNotFound logic
* Variable fixes (#67)V2.0.3Bruce Wells2020-06-041-1/+1
| | | | | | | | | | | * Reproduce if throws UnknownOperatorException * Fix variable detection * Adding IncorrectNumberOfFunctionParametersException * Removing tabs * Better exception message text
* Code style fixes & Github Actions (#65)V2.0.2Alexander Kiryukhin2020-06-011-2/+2
| | | | | | | | | | | | * Code style fixes Up phpunit to v8 New CI * Remove travis * Fix CI badge * Added php-cs-fixer action
* typed parameters and return typesBruce Wells2020-05-201-1/+1
|
* Cleanup unused importsAlexander Kiryukhin2020-05-151-6/+0
|
* Massive refactoringAlexander Kiryukhin2020-05-151-15/+46
| | | | | More clean structure Parsing without regular expressions
* Update documentation for PHPFUI/InstaDoc (#58)Bruce Wells2020-04-111-3/+3
|
* Fixed comma operatorBruce Wells2019-01-161-8/+4
| | | | | Added unit tests for expressions in function arguments. Changed array_push to $var[] = native code.
* Fixed function parameter orderBruce Wells2019-01-121-8/+4
| | | | | | | Corrected $places default value for addFunction to match TokenFactory Added function order test and put expected order first in assertEquals If else blocks in calculator Updated docs
* sync (#5)Bruce Wells2019-01-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Added simple coc (#37) * Added simple coc * Fix * Replaceable operators (#38) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Allow for operators to be replaced based on regex expression * Fix md typo (#39) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Syncing to origin (#4) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Added simple coc (#37) * Added simple coc * Fix * Replaceable operators (#38) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Allow for operators to be replaced based on regex expression * \\ instead of \ * Update README.md Some small fixes * Fix single quotes parsing (#41) * Fix single quotes parsing Fix e-mails Some small fixes * Mistake in test * More PHP versions * Update README.md Deleted `dev` branch
* Additional validation for bad expressions (*+ for example)Bruce Wells2018-10-241-1/+1
|
* Support for double quoted stringsBruce Wells2018-09-121-2/+6
| | | | | | | | Changed array() to [] syntax. Added variable in question to unknown variable exception. Added getVar and getVars accessor functions. Added getOperators and getFunctions accessor functions for completeness. Extended all Exceptions off MathExecutorException.
* + Added cache, which speeds up the repetitive calculationsNeonXP2013-09-061-3/+16
| | | | + Returned variables, because they need for cached expressions
* Mass refactoringNeonXP2013-09-061-0/+46
Some changes: + Added support of functions with multiple arguments + Added some default function (min, max, avg). just example of multiple arguments :) - Removed variables support (I think they pointless) ~ All tokens now in individual classes ~ Parsing based on regular expressions ~ Fix negative numbers ~ Fix grouping with brackets