Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSilence committed Apr 12, 2022
1 parent b6b0b31 commit 3397515
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
# ensostudio/comparator

Package to comparing any values.

# Installation

The flexible comparation of any values.
### Installation
Via Composer:
```bash
~~~bash
composer require ensostudio/comparator
```
~~~
### API
~~~php
namespace EnsoStudio\Comparator;
class Comparator
{
public function __construct(int $flags);
public function setFlags(int $flags);
public function getFlags(): int;
public function hasFlag(int $flag): bool;
public function compare(mixed $value, mixed $value): bool;
}
~~~
### Usage
~~~php
use EnsoStudio\Comparator\Comparator;
$comparator = new Comparator(Comparator::EQUAL_ARRAY | Comparator::EQUAL_FLOAT);
if ($comparator->compare(['float' => 2 - 1.6, 'int' => 3], ['int' => 3, 'float' => 0.4])) {
echo 'equal values';
}
~~~

0 comments on commit 3397515

Please sign in to comment.