Download the PHP package kirouane/interval without Composer
On this page you can find all versions of the php package kirouane/interval. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package interval
Interval
This library provides some tools to handle intervals. For instance, you can compute the union or intersection of two intervals.
Use cases
- Availabilities calculation.
- Scheduling/calendar/planning.
- Mathematics interval computation with open/closed boundaries
- etc
Features
- It computes some operations between two intervals: union, intersection and exclusion.
- It computes some operations between two sets of intervals: exclusion for now.
- It handles several types of boundaries : float, \DateTime and integer.
- It handles infinity type as boundary.
- Ability to combine infinity with \DateTime and other types.
- filter, sort, map.
- Immutability.
- Chain operations.
Quality
- Code coverage
- Mutation test : Code coverage more than 90%
- Takes care of performance and memory usage
- PSR1/PSR2, Code Smell
Install
composer require kirouane/interval
Basic usage
Let's assume an interval [20, 40]. We instantiate a new Interval object .
or
We can do some operations like :
-
Intersection :
- Union :
or
- Exclusion :
or
We can compare two intervals as well:
-
Overlapping test :
- Inclusion test :
Use DateTimeInterface as boundary
- Union :
Use Infinity as boundary
- Exclusion :
Operations on sets (arrays) of intervals
- Exclusion :
Chaining
Advanced usage
You can create intervals with open boundaries :
Contributing
You are very welcomed to contribute to this Library!
-
Clone
git clone https://github.com/Kirouane/interval.git
-
Install
composer install
ormake install
(with docker and docker-compose) -
Test
vendor/bin/phpunit
- Build
vendor/bin/grumphp run