Download the PHP package scheb/comparator without Composer
On this page you can find all versions of the php package scheb/comparator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scheb/comparator
More information about scheb/comparator
Files in scheb/comparator
Package comparator
Short Description Compares to values for equality
License MIT
Homepage https://github.com/scheb/comparator
Informations about the package comparator
scheb/comparator
This library compares two values for equality.
If you need to add your own rules for comparing specific values, you can extend the library with your own comparison strategies.
Features
- Simple equality comparison (
==
or===
) - Strategy interface for your own comparison rules
Installation
How to use
How to extend
To add your own comparison strategy, implement Scheb\Comparator\ValueComparisonStrategyInterface
.
Then, add an instance of that class via the constructor argument $customComparisonStrategies
of
Scheb\Comparator\Comparator
.
Custom comparison strategies take preference over default ones.
Contribute
You're welcome to contribute to this library by creating a pull requests or feature request in the issues section. For pull requests, please follow these guidelines:
- Symfony code style
- PHP7.1 type hints for everything (including: return types,
void
, nullable types) - Please add/update test cases
- Test methods should be named
[method]_[scenario]_[expected result]
To run the test suite install the dependencies with composer install
and then execute bin/phpunit
.
License
This bundle is available under the MIT license.